Absurd declarations, and how gcc deals with them.

Ian Lance Taylor iant@google.com
Sat Oct 11 05:49:00 GMT 2008


"Sisyphus" <sisyphus1@optusnet.com.au> writes:

> I have some auto-generated C code that contains declarations like:
>
>    int x[0];
>    int y[] = {};

> What does gcc-3.x.x do with declarations like that (and why) ?

gcc supports empty arrays as an extension to the C language.  It
should reject that code if you compile with -pedantic.  Empty arrays
are mainly useful as the last field of a struct.

This language extension is even documented in the fine manual.

Ian



More information about the Gcc-help mailing list