This is the mail archive of the gcc-help@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]
Other format: [Raw text]

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


>>>>   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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]