This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: egcs / g++ conflicts c++ draft standard (i think)


| Note that the standard allows
| 
| class foo
| {
|     static const int qtd = 100;
| };
| 
| (as does g++) although many compilers don't yet implement it.
| 
| (Perhaps it is time for g++ to allow only 'static', or to at least
| warn about other uses like this).

It already does:

~>g++ tst.cc
tst.cc:6: warning: ANSI C++ forbids initialization of const member `qtd'
tst.cc:6: warning: making `qtd' static

| > -- Dynamic allocation of array bounds (no const bounds)

Nevertheless, you need -pedantic before you get a warning:

~>g++ -pedantic tst.cc
tst.cc: In function `int main(int, char **)':
tst.cc:13: warning: ANSI C++ forbids variable-size array `dynarray'

I think that this warning should also be given, or probably even
be turned into an error, when compiling with -ansi :

~>g++ -ansi -Wall tst.cc
~>

(No warning or error)

-- 
 Carlo Wood  <carlo@runaway.xs4all.nl>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]