This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: is this legal C?
- From: llewelly at xmission dot com
- To: sds at gnu dot org
- Cc: gcc-help at gcc dot gnu dot org
- Date: 14 May 2004 21:24:10 -0600
- Subject: Re: is this legal C?
- References: <uhduizzoc.fsf@gnu.org>
Sam Steingold <sds@gnu.org> writes:
> suppose BAR is defined and QWE is not.
> does the following do what I expect it to:
>
> struct { char* name; } foo [] = {
> { "ABC"
> #if defined(BAR)
> "ZZZ"
> #endif
> },{
> #if defined(QWE)
> "ZOO"
> #endif
> "XYZ"
> }}
>
> i.e., create an array of length 2 with elements named "ABCZZZ" and
> "XYZ"? (it does, with GCC)
> is this portable?
> is this legal ANSI C?
I think so, but I don't have a copy of the C90 or C99 standard.