C/C++ Programmer's Guide (G06.25+)

HP C/C++ Programmer’s Guide for NonStop Systems429301-008
13-1
13 Compiler Pragmas
Compiler pragmas enable you to control various elements of compiler listings, code
generation, and building of the object file.
You can specify pragmas in the following 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 the HP Enterprise Toolkit or the Tandem Development Suite on the PC, typically
by selecting from the Options|Project|Compiler General Options page.
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 details, see 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 information, see the description of SYSTYPE on page 13-101
Table 13-1 summarizes the compiler pragmas. Complete descriptions of each pragma
follow the 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.
BUILD_NEUTRAL_LIBRARY
Directs the TNS/E native compilers to create a C++
library using only those definitions common to the
VERSION2 and VERSION3 libraries and to set the
CPPNEUTRAL flag in the linkfile.