Re: Absurd declarations, and how gcc deals with them.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>   int x[0];
>>>>   int y[] = {};
> ...
>>> gcc supports empty arrays as an extension to the C language.  It
>>> should reject that code if you compile with -pedantic.
>> 
>> Yes, you're right - if I give some leeway over the meaning of "rejection"
>> :-)
>> With -pedantic I get the following warnings:
>> 
>> warning: ISO C forbids zero-size array `x'
>> warning: ISO C forbids empty initializer braces
> ...
>> In any case, I'm not so sure that I should haul gcc over the coals wrt
>> this. If there's any evil being done, then it's probably being done by the
>> code auto-generation procedure that's coming up with these constructs.
> 
> If the goal is to have an error, you can always use -Werror.

Or -pedantic-errors in this situation.

--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux