The extensions described below do not conform to the language features described in the ANSI/ISO standard and could thus result in potentially non-portable source programs if used.
Special character $ and @ in identifiers
By default, the “dollar” symbol $ and the “at” sign @ are permitted in internal and external names. This can be suppressed by means of options (see “Identifiers” (Implementation-defined behavior based on the ANSI/ISO C standard )).
main function with three parameters
In addition to the two parameters argc and argv (see "Implementation-defined behavior based on the ANSI/ISO C standard (C/C++-Compiler, #89)"), a third parameter char *
envp[]
may be declared, where envp is a pointer to an array of strings that is supplied with information on the system environment. See the manual “C Library Functions for POSIX Applications” [3 (Related publications )] for details.
Scope of functions
extern
declarations of functions within blocks apply to the entire compilation unit. If multiple extern
declarations are available for the same function, they are tested for a match.
Write access to string literals
In this implementation, string literals can be overwritten by default. This ensures that the literals do not overlap. Identical literals are stored in separate areas.
The -K rostr
and STRING-LITERALS=*READ-ONLY options can be used to specify read-only access for string literals.
Conversion of function pointers
The cast operator can be used to convert pointers to objects to pointers to functions, and vice versa. In the case of implicit conversions, warnings are issued by the compiler.
Non-integer bitfields
All integral types can be used as bitfields (see also “Bitfields” (Implementation-defined behavior based on the ANSI/ISO C standard )). The standard only defines the types int
, unsigned int
and signed int
.
The asm keyword
The asm
keyword is reserved in K&R mode and in extended C mode. However, since the inline substitution of Assembler code is not yet supported, the use of this keyword will result in an error. The asm
keyword is not reserved in the strict C mode.
Multiple definitions of external variables
If there are so-called “tentative” definitions for the same object (i.e. external declarations of variables without the attribute extern
or static
) in several compilation units, these must always be of the same type. Different type declarations for the same external object are not recognized by the compiler. Multiple initializations of external variables will result in errors on linkage. This behavior can be controlled with options (-K external_multiple
, -K external_unique
and EXTERNAL-DEFINITION=*UNIQUE/*MULTIPLY-ALLOWED).
Empty macro arguments
When calling macros, it is also possible to pass empty arguments.
Example
#define F(a,b) f(a)+f(b); F(1) /* produces f(1)+f(); */ F(,1) /* produces f()+f(1); */
Predefined macros
For compatibility reasons, some predefined macros do not begin with the underscore (_) character (see the section “Predefined preprocessor names”).
Additional preprocessor directives
The following additional preprocessor directives are accepted by the compiler:#line
(old format), #ident
, #assert
and #unassert
.
#line
directive (old format):
#'BLANK'
digit-sequence'BLANK'[
header-file]
This directive is identical to the #line
directive, except for the fact that the keyword line
is omitted.
#ident
directive:
#ident'BLANK'"
string"
The #ident
directive, which is equivalent to the #pragma ident
, is accepted syntactically, but does cause any changes in the generated object. The compiler does not issue any notes or warnings, since these directives are used internally in system headers.
#assert
directive:
#assert'BLANK'
name[(
token-sequence)]
The #assert
directive can be used to define an assertion. Assertions are independent of macro definitions.
name is the name of the assertion, and token-sequence is the value to which the assertion applies.
A single token may be one of the following lexical units: name, keyword, constant, string, operator, separator/punctuation character. If no token-sequence is specified, the assertion is considered defined as in the case of a symbolic constant, but no value is assigned.
The #if
statement can be used to test whether an assertion applies to a value:
#if #
name(
non-empty-token-sequence)
name is the name of the assertion, and non-empty-token-sequence is the value to be tested. For example, the following test for the predefined assertion compiler
would return the value “true”:
#if #system(bs2000)
The predefined assertions are described in the appendix under “Predefined preprocessor assertions (#assert)” (Predefined preprocessor names).
#unassert
directive:
#unassert'BLANK'
name[(
token-sequence)]
The #unassert
directive has the same syntax as #assert
and can be used to remove any assertion.
If a token-sequence is specified, only the assertion for that value is removed; otherwise, i.e. if no token-sequence is specified, the entire assertion is deleted.