C/C++ Programmer's Guide (G06.25+)
Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
13-26
EXTENSIONS
•
The native mode C++ compiler expects ANSI-compliant code unless you include
the EXTENSIONS pragma. To avoid warnings or errors on features that are not
strictly ANSI-compliant, you must use the EXTENSIONS pragma on the command
line.
•
When the EXTENSIONS pragma is used with the TNS/E native mode compiler and
all of the following are true:
°
The formal parameter type is a pointer to an integer type
°
The actual parameter type is a pointer to an integer type
°
Both integer types have the same size
°
Both integer types are signed or both are unsigned
no warning is displayed. If the integer types have the same size, but are not both
signed or both unsigned, a warning is displayed. If the integers are of different
sizes, an error occurs.
•
The following extensions to the C language are accepted when you specify the
EXTENSIONS pragma. (Unless stated otherwise, when each of these features is
compiled without extensions enabled, the behavior is for the compiler to issue a
warning; compiling with extensions enabled issues no diagnostic. Generally, these
C extensions are also part of the C++ proposed standard; thus, unless there is a
statement to the contrary, these features are accepted when compiling in C++
mode regardless of the setting of extensions.)
°
A translation unit (input file) can contain no declarations.
°
Bit fields may have base types that are enums or integral types besides int
and unsigned int.
°
The last member of a struct can have an incomplete array type. It must not
be the only member of the struct (otherwise, the struct would have zero
size). (This is not allowed in C++.)
°
A file-scope array can have an incomplete struct, union, or enum type as its
element type. The type must be completed before the array is subscripted (if it
is), and by the end of the compilation if the array is not extern. (This is not
allowed in C++.)
°
Static functions can be declared in function and block scopes. Their
declarations are moved to the file scope. (This is not allowed in C++.)
°
enum tags can be incomplete; one can define the tag name and resolve it (by
specifying the brace-enclosed list) later. (C and C++ behavior is the same.)
°
The values of enumeration constants can be given by expressions that
evaluate to unsigned quantities that fit in the unsigned int range but not in the
int range. (C and C++ behavior is the same.)
°
An extra comma is allowed at the end of an enum list. A remark is issued. (C
and C++ behavior is the same.)