The list of compatibilities listed below are gcc compatibilities provided by Comeau C in GNU C mode;
in fact, the --gcc and --no_gcc command-line switches imply C mode even
when no --c option is specified.
The list of Comeau's support for g++ compatibilities are listed further below.
The set of extensions enabled with the --gcc option includes the following, shown in no meaningful order:
- variable length arrays, aka VLAs
- extended designated initializers
- compound literals (including some extended over C99 to allow more kinds of initializations)
- variadic macros and extended variadic macros
- identifiers with dollar signs
- C++-style comments
- digraphs
- long long (and related extensions provided by C99)
- hexadecimal floating-point constants
- nonconstant aggregate initializers for automatic variables
- the typeof operator
- the __inline__ and inline keyword
- the __asm__ keyword
- the __extension__ keyword
- __FUNCTION__ and __PRETTY_FUNCTION__
- zero-sized arrays
- the \e escape sequence
- Empty structs and structs with flexible array members
- Attributes
- &&label
- goto *expression
- builtin functions (but not yet all 3.x ones)
- Statement expressions i.e., ({...})
- Multi-line strings
- Binary conditional operators ("x ?: y")
- extern inline
- The sizeof operator is applicable to void and function types
and evaluates to the value one. Arithmetic on pointers to these types
is possible (they behave much like char*).
- Variables can be redeclared with different top-level cv-qualifiers (the new qualification
is merged into existing qualifiers).
- Locally declared labels.
- Generalized lvalues: the (ternary) conditional operation produces
an lvalue if its second and third operand are lvalues, the comma operator
produces an lvalue if its second operand is an lvalue, and certain casts
also preserve the lvalueness of their operands.
- Case ranges.
- Assembler names of variables and routines.
- Union casts.
- Implicit conversions between integer and pointer types, and
between incompatible pointer types, with a warning. Also implicit
conversions between pointer types that drop cv-qualifiers.
- typedef initializers
- Extended asm syntax
- Variables mapped to specific registers.
- --preinclude_macros option (like the gcc --imacros feature)
- Do-nothing casts to struct or union types
- Return expressions in void functions.
- Oversized bit fields are turned into ordinary fields
- Builtin varargs operations.
- Old-style definitions with unpromoted parameter types can follow
function prototypes with those same parameter types.
- _Bool keyword
- "?" operators with mixed void/non-void operands.