Re: is this legal C?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sam Steingold <sds@xxxxxxx> 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. 

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux