egcs / g++ conflicts c++ draft standard (i think)
Carlo Wood
carlo@runaway.xs4all.nl
Sat Jul 25 06:09:00 GMT 1998
| 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>
More information about the Gcc
mailing list