Re: what's this syntax?

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

 



Sure.

My question is how to interperate the code, since I don't understand its syntax.

If it is a C99 code, what's the C99 feature for it ?

Thanks.

Mike



----- Original Message ----- From: "Ian Lance Taylor" <iant@xxxxxxxxxx>
To: "Michael Gong" <mwgong@xxxxxxxxxxxxxx>
Cc: <gcc-help@xxxxxxxxxxx>
Sent: Sunday, December 10, 2006 11:05 PM
Subject: Re: what's this syntax?


"Michael Gong" <mwgong@xxxxxxxxxxxxxx> 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();
}



[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