funny problem with g++

Tommy Vercetti vercetti@zlew.org
Wed Dec 7 15:15:00 GMT 2005


Hi there

We had funny issue here lately. Someone wanted to create table that  
had 0 elements in C++, for instance this code:

int main()
{
         char a[0];
         char b[0];

         a[0] = 1;
         b[0] = 2;

         return a[0] + b[0];
}

is perfectly ok for g++, it isn't for other compilers.
I would say this should cause fatal error. Even without any -W flags on.
-pedantic works fine, but this should be an error always, not just  
when -pedantic is used.


Thanks.

-- 
TV

"If we knew what we were doing, it wouldn't be called Research, would  
it?" - AE






More information about the Gcc mailing list