what's this syntax?

Ian Lance Taylor iant@google.com
Mon Dec 11 04:06:00 GMT 2006


"Michael Gong" <mwgong@cs.utoronto.ca> writes:

> The following could be compiled by gcc. Can anyone tell me what's the
> feature of gcc to support the syntax ?

I believe this is standard C99 code, not a gcc extension.  It's a gcc
extension to accept this in C90 mode.

I don't really understand what your question means, anyhow.  Can you
rephrase?

Ian

> void foo() {
>   if(
>       ( __extension__
>           (
>               (
>                   (
>                       union {
>                           int a;
>                           int b;
>                      }
>                   ) { .a =7 }
>               ) .b
>            )
>         ) == 7 ) {
>               printf("abc\n");
>     }else {
>               printf("def\n");
>    }
> }
> 
> int main() {
>  foo();
> }



More information about the Gcc-help mailing list