This appendix presents the IBM C extensions by category. The major categories are whether an extension is orthogonal or non-orthogonal to a base language. An orthogonal extension does not interfere with the base language. Orthogonal extensions are collectively enabled by compiling in one of the extended modes: extended, extc89, and extc99. The extended mode is based on C89.
Non-orthogonal extensions on the other hand may change the syntax or semantics of a base language feature. Therefore, each IBM C extension that is non-orthogonal to the base language or that conflicts with its GNU C implementation must be explicitly requested by an option.
The syntax for the positive and negative langlvl suboptions is:
-qlanglvl=lang_suboption -qlanglvl=nolang_suboption
Options and suboptions are case-insensitive.
The orthogonal IBM C extensions fall into three subgroupings: language features with individual option controls from previous releases, those that are C99 features, and those related to GNU C.
Some existing language features that are orthogonal to C89 have individual
positive and negative option controls. For backward compatibility,
these compiler options and suboptions continue to be supported.
Enabling a feature redundantly will not change its enabled state.
The IBM C language extensions with individual option controls | ||
Language Extension | Compiler Option | Remarks |
---|---|---|
dollar sign in identifier | -qdollar | Accepted by all levels. |
UCS | -qlanglvl=ucs | The negative setting, -qlanglvl=noucs, is ignored by STDC99 with an informational message. |
digraph | -qdigraph | The negative setting, -qnodigraph, is ignored by STDC99 with an informational message. |
Most of the language features related to C99 are orthogonal to C89. The exception is the restrict keyword, which invades the user's variable name space. You can request the support explicitly by using the -qkeyword=restrict option.
C99 features as extensions to C89 | |
Language Feature | Remarks |
---|---|
The restrict type qualifier | Defines a restricted pointer |
Variable length arrays | -qlanglvl=c99vla |
Flexible array members | C99 allows a flexible array member only at the end of a struct. GNU C allows it anywhere in the structure. |
Support for the complex data type |
|
The long long int type |
|
Support for hexadecimal floating-point constants |
|
Removal of implicit int |
|
Refined definition of integer division | Truncation toward zero |
Universal character names |
|
Extended identifiers | Limit removed for internal and external names |
Compound literals |
|
Designated initializers |
|
C++ style comments |
|
Removal of implicit function declaration |
|
Preprocessor arithmetic done in intmax_t/uintmax_t |
|
Mixed declarations and code |
|
New block scopes for selection and iteration statements |
|
Integer constant type rules | To accommodate the long long int type |
Integer promotion rules | To accommodate the long long int type |
vararg macros | Function-like macros with variable arguments |
Trailing comma allowed in enum declaration |
|
Definition of the _Bool type |
|
Idempotent type qualifiers | Also known as "duplicate type qualifiers" |
Empty macro arguments |
|
Additional predefined macro names |
|
_Pragma preprocessing operator |
|
Standard pragmas | #pragma STDC FP_CONTRACT#pragma STDC FENV_ACCESS#pragma STDC CX_LIMITED_RANGE |
__func__ predefined identifier |
|
UTF-16, UTF-32 literals |
|
The IBM C compiler recognizes the following subset of the GNU C language
extensions. The descriptive labels used in the following table are
similar to those in the GNU C documentation.
The IBM C extensions related to GNU C | |
Language Feature | Remarks |
---|---|
Statements and Declarations in Expressions |
|
Locally Declared Labels |
|
Labels as Values | Including computed goto statements |
Nested Functions |
|
Referring to a Type with typeof | The alternate spelling, __typeof__, is recommended. |
Generalized Lvalues |
|
Double-Word Integers |
|
GNU C Complex Types |
|
GNU C Hexadecimal Float Constants |
|
Arrays of Length Zero |
|
Arrays of Variable Length |
|
Macros with a Variable Number of Arguments | Using an identifier in place of __VA_ARGS__ |
Non-Lvalue Arrays May Have Subscripts |
|
Non-Constant Initializers |
|
Compound Literals |
|
Cast to a Union Type | C-only |
Declaring Attributes of Functions |
|
Function prototype overriding a nonprototype definition |
|
__alignof__ to inquire about the alignment |
|
Specifying Attributes of Variables |
|
Specifying Attributes of Types |
|
Assembler Instructions with C Expression Operands |
|
Variables in Specified Registers | The compiler accepts the GNU syntax, but ignores the semantics. |
Alternate Keywords |
|
#warning |
|
#include_next |
|
The non-orthogonal IBM C extensions fall into three subgroupings: language features from previous releases, those that are C99 features, and those related to GNU C.
Strictly speaking, the IBM C language feature upconv is
correctly classified as non-orthogonal. However, it is automatically
enabled as part of the extended language level. This is the
major difference between extended and extc89.
The non-orthogonal IBM C language extensions | ||
Language Extension | Compiler Option | Remarks |
---|---|---|
long long literal | -qlonglit | Ignored by stdc99 with a warning. |
upconv | -qupconv | Available by default at the -qlanglvl=extended language level. |
The non-orthogonal IBM C language extensions | |
Language Extension | Remarks |
---|---|
The inline keyword | Non-orthogonal to C89 and GNU C. |
Flexible array members | C99 allows a flexible array member only at the end of a struct. GNU C allows it anywhere in the structure. |
The non-orthogonal GNU C extension | |
Language Extension | Compiler Suboption and Remarks |
---|---|
Macros with a Variable Number of Arguments | Removing the trailing comma when no variable arguments are specified. |
IBM C extensions for AltiVec vector programming | |
Language Extension | Compiler Suboption and Remarks |
---|---|
Vector programming language extensions | -qaltivec
Keywords, macros, and pragmas to support the AltiVec programming model. |