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:
({int a; a=myfunc(); a; })
int count_leading_zero(int value)
{
asm ( "cntlzw %0, %1" : "=r" (bits) : "r" (value) );
return bits;
}
#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;
struct Incomplete arr[10];
class MyClass {
...
int MyClass::getval();
...
};
struct empty { } x;
struct empty { } x = {};
typedef struct { int x, y, z; float q; } mystruct;
void foo(mystruct s);
foo( (mystruct) { 1,2,3,6e3 } );
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.
switch(x) {
label:
}
#define MAC 3
#define MAC (3)
int a[10], b[10];
a = b;
enum { A, B, C, };
typedef struct {
int type;
char data[];
} Node;
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.