This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Absurd declarations, and how gcc deals with them.
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Sat, 11 Oct 2008 09:24:44 -0500
- Subject: 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