Mail Archives: djgpp/1998/05/23/14:00:42
Aleksey Kondratyev schrieb in Nachricht <6k63ce$4t9$3 AT simtel DOT ru>...
>Replying one message from comp.lang.c++ I discovered a strange
>DJGPP behavior. IMHO C++ standard forbids the construction below.
>
>class base
>>{
>>protected:
>> const int nn[]={10,20};
>
>A C++ class members can be initialized by the use of a constructor only.
>The author of an original message <6k5lsf$40i$1 AT news DOT iastate DOT edu>
>in comp.lang.c++ claimed that g++ 2.8.0 compiles such things fine
>but abandons to link saying that 'nn' is unresolved.
>I tried DJGPP 2.8.0 and it did the same. Is it a bug?
>
g++ (version 2.7) gives you this warning:
Warning: ANSI C++ forbids initialization of member `nn'
it compiles AND links fine, however.
the error in the linker is because of the "const" keyword...
i think this isn't a bug, because the warning tells you that
you're doing something not ANSI-compliant...
Elias Pschernig
- Raw text -