C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
13-1
13 Compiler Pragmas
Compiler pragmas enable you to control various elements of compiler listings, code
generation, and building of the object file.
Specify pragmas in these ways, using the method that is appropriate to the compiler
and platform you are using:
In the TACL RUN command that you enter to run the native C and C++ compilers,
the TNS C compiler, and Cfront
In the G-series TNS c89 utility accompanied by a -Wccom flag
In the native c89 utility accompanied by a flag that corresponds to the pragma (For
descriptions of the individual flags, see the c89(1) reference page either online or
in the Open System Services Shell and Utilities Reference Manual.)
In TDS on the PC, typically by selecting from the Options|Project|Compiler General
Options page.
For ETK, the pragmas are set at the project level "Configuration Dependent
Properties". It can be accessed within the project properties dialog at the location
"Configuration Properties->C/++".
In addition, some pragmas can be specified in the source file itself. Descriptions of the
pragmas in this section describe the methods for specifying each pragma. In most
cases, pragmas in the source file take precedence over the pragmas in the RUN
command or specified to the c89 utility. For more details, see the individual pragma
descriptions.
The compiler version and SYSTYPE setting determine the default values of pragmas.
The compilers in the Guardian environment default to SYSTYPE GUARDIAN. The
compilers in the OSS environment, which are invoked through the c89 utility, default to
SYSTYPE OSS. For more details, see SYSTYPE on page 13-104
Table 13-1 summarizes the compiler pragmas. Complete descriptions of each pragma
follow this table.
Table 13-1. Compiler Pragma Descriptions (page 1 of 7)
Pragma Purpose
ALLOW_CPLUSPLUS_COMMENTS
Directs the native mode C compiler to allow the use of
comments entered in the style of the C++ language.
ALLOW_EXTERN_EXPLICIT_INST
ANTIATION
Specifies an extern to be applied to an explicit
template instantiation.
ANSICOMPLY
Directs the TNS C compiler to perform strict syntax
checking for compliance to the ISO/ANSI C standard.
ANSISTREAMS
Specifies that Guardian files created by the program,
including the standard files (standard input, standard
output, and standard error), are odd-unstructured disk
files with a file code of 180.