### GCC Extension Support

Use the GCC Extensions setting to enable the compiler to accept some GCC syntax and conventions. This option is the same as the previously-supported #pragma gcc_extensions.

The following GCC compatibility enhancements have been added:

- Statements in expressions are allowed

> ({int a; a=myfunc(); a; })

- GCC-style inline assembly supported on some targets only

> int count_leading_zero(int value)
> {
> asm ( "cntlzw %0, %1" : "=r" (bits) : "r" (value) );
> return bits;
> }

- GCC-style macro varargs supported

> #define DEBUG(fmt,args...) printf(fmt, ## args)
> DEBUG("test");
> DEBUG("saw %d copies\n", n_copies);
> • The abbreviated “?:” operator is allowed
> x = y ?: z; // --> x = y ? y : z;

- Allow incomplete structs in array declarations

> struct Incomplete arr[10];

- Allow Class::Member in a class declaration

> class MyClass {
> ...
> int MyClass::getval();
> ...
> };

- Allow empty structs

> struct empty { } x;

- Allow empty struct initialization

> struct empty { } x = {};

- Struct initializer typecast support

> typedef struct { int x, y, z; float q; } mystruct;
> void foo(mystruct s);
> foo( (mystruct) { 1,2,3,6e3 } );

- Limited support for “void *” and function pointer arithmetic

> void *p;
> p = &data + 10; // point 10 bytes into "p"
> void foo();
> p = foo + 10; // point 10 bytes into "foo"
> At this time, the increment and decrement operators “++” don’t work with void/function pointers.

- sizeof(function) and sizeof(void) is 1
- Function pointers may be compared to “void *”
- Allow null statement (no trailing semicolon) in “switch”

> switch(x) {
> label:
> }

- Macro redefinitions with different values allowed

> #define MAC 3
> #define MAC (3)

- “<?”, “>?” MIN/MAX operators supported for some targets
- Arrays may be assigned

> int a[10], b[10];
> a = b;

- Allow trailing comma in enumerations without warning

> enum { A, B, C, };

- Allow empty array as final member of struct

> typedef struct {
> int type;
> char data[];
> } Node;

- Designated initializer support

> struct { int x, y, z; float q; } x = { q: 3.0,
> y:1, z:-4, x:-6 };

For related information, see the #pragma gcc_extensions.