Extensions for GNU C compatibility

The following features are enabled by default when you compile with the xlc invocation command. They are also enabled with the options -qlanglvl=extc89 (the default in xlc), -qlanglvl=extc99, and -qlanglvl=extended.

Table 30. Default IBM XL C extensions for GNU C compatibility
Language feature Discussed in:
Alternate keywords Keywords for language extensions
__extension__ keyword Keywords for language extensions
asm labels Assembly labels
Complex literal suffixes Complex literals
Global register variables Global variables in specified registers (C only)
Placement of flexible array members anywhere in structure or union Flexible array members
Static initialization of flexible array members of aggregates Flexible array members
Zero-extent arrays Zero-extent array members
Type attributes Type attributes
Variable attributes Variable attributes
Locally declared labels Locally declared labels
Labels as values Labels as values
__alignof__ operator The __alignof__ operator
__typeof__ operator The typeof operator
Generalized lvalues Lvalues and rvalues
Complex type arguments to unary operators Unary expressions
Initialization of static variables by compound literals Compound literals
__imag__ and __real__ complex type operators The __real__ and __imag__ operators
Cast to a union type Cast to union type (C only)
Computed goto statements Computed goto statement
Statements and declarations in expressions Statement expressions
Function attributes Function attributes
__inline__ function specifier The inline function specifier
Nested functions Nested functions
Variadic macro extensions Variadic macro extensions
#warning preprocessor directive The #warning directive
#include_next preprocessor directive The #include_next directive
#assert, #unassert preprocessor directives Assertion directives

The following features are enabled by default when you compile with the xlc invocation command. They are also enabled with the options -qlanglvl=extc89 (the default in xlc), -qlanglvl=extc99, and -qlanglvl=extended. They can also be enabled and disabled by specific compiler options, which are listed in the table below.

Table 31. IBM XL C extensions for GNU C compatibility with individual option controls
Language feature Discussed in: Individual option controls
typeof, asm, and __asm keywords The typeof operator, Assembly labels, Inline assembly statements -qkeyword
asm inline assembly-language statements Inline assembly statements -qasm

The following feature requires compilation with the use of an additional option.

Table 32. 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

Related information