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: Ian Lance Taylor <iant at google dot com>
- To: "Sisyphus" <sisyphus1 at optusnet dot com dot au>
- Cc: "gcc" <gcc-help at gcc dot gnu dot org>
- Date: Fri, 10 Oct 2008 22:48:59 -0700
- Subject: Re: Absurd declarations, and how gcc deals with them.
- References: <D3153B65BCA242ECB1840E3B0ADBF741@desktop2>
"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