Extensions for GNU C compatibility

The following subset of the GNU C language extensions is enabled with the -qlanglvl=extended option, which is the default language level used when you compile with the xlC and xlc++ invocation commands.

Table 38. Default IBM XL C++ extensions for compatibility with GNU C
Language feature Discussed in:
Assembly labels Assembly labels
Placement of flexible array members anywhere in structure or union Flexible array members
Static initialization of flexible array members of aggregates Flexible array members
Type attributes Type attributes
Variable attributes Variable attributes
Statements and declarations in expressions Statement expressions
__alignof__ operator The __alignof__ operator
__typeof__ operator The typeof operator
Generalized lvalues Lvalues and rvalues
Complex type arguments to unary operators Unary expressions
__imag__ and __real__ complex type operators The __real__ and __imag__ operators
Function attributes Function attributes

The following subset of the GNU C language extensions is enabled with the -qlanglvl=extended option, which is the default language level used when you compile with the xlC and xlc++ invocation commands. These extensions can also be enabled or disabled by specific compiler options, which are listed in the table below.

Table 39. Default IBM XL C++ extensions for compatibility with GNU C, with individual option controls
Language feature Discussed in: Individual option controls
Alternate keywords Keywords for language extensions -q[no]keyword=token
__extension__ keyword Keywords for language extensions -q[no]keyword=__extension__
Complex literal suffixes Complex literals -qlanglvl=[no]gnu_suffixij
Zero-extent arrays Zero-extent array members -qlanglvl=[no]zeroextarray
typeof operator The typeof operator -q[no]keyword=typeof
Locally declared labels Locally declared labels -qlanglvl=[no]gnu_locallabel
Labels as values Labels as values -qlanglvl=[no]gnu_labelvalue
Computed goto statements Computed goto statement -qlanglvl=[no]gnu_computedgoto
inline assembly-language statements Inline assembly statements -qasm
Variadic macro extensions Variadic macro extensions -qlanglvl=[no]gnu_varargmacros
#warning preprocessor directive The #warning directive -qlanglvl=[no]gnu_warning
#include_next preprocessor directive The #include_next directive -qlanglvl=[no]gnu_include_next
#assert, #unassert preprocessor directives Assertion directives -qlanglvl=[no]gnu_assert

The following feature requires compilation with the use of an additional option, listed in the table below.

Table 40. IBM XL C++ extensions for GNU C compatibility, requiring additional compiler options
Language feature Discussed in: Required compilation option
Dollar signs in identifiers Characters in identifiers -qdollar