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

Table Of Contents
Preprocessor Directives and Macros
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
12-15
Feature-Test Macros
The _TANDEM_SOURCE macro makes supplementary functions defined by HP for
NonStop systems. If a module compiled for the OSS environment uses functions
defined by HP, you must specify the _TANDEM_SOURCE macro.
The _XOPEN_SOURCE macro makes visible functions defined by either the XPG4 or
XPG4 Version 2 specifications. The _XOPEN_SOURCE_EXTENDED macro makes visible
XPG4 Version 2 extensions to functions that have base definitions defined in the XPG4
specification.
The _GUARDIAN_TARGET and _OSS_TARGET macros identify a module’s execution
environment. The compiler uses this information to resolve references to external
functions in the C run-time library.
For the TNS compilers, the pragma SYSTYPE GUARDIAN defines the
_GUARDIAN_TARGET and _TANDEM_SOURCE macros. For the native compilers, the
pragma SYSTYPE GUARDIAN defines only the _GUARDIAN_TARGET macro, while the
EXTENSIONS pragma defines the _TANDEM_SOURCE macro. Pragma SYSTYPE OSS
defines the _OSS_TARGET and _XOPEN_SOURCE macros.
If the compiler is running in the Guardian environment and SYSTYPE OSS is specified,
the compiler undefines _GUARDIAN_TARGET before it defines _OSS_TARGET. If the
compiler is running in the OSS environment and SYSTYPE GUARDIAN is specified, the
compiler undefines _OSS_TARGET before it defines _GUARDIAN_TARGET.
Do not define or undefine the _GUARDIAN_HOST, _OSS_HOST, _TNS_E_TARGET, and
_TNS_R_TARGET macros. These macros are for use by the compiler only.
The __TANDEM_ARCH_ macro can be used to compile code conditionally, depending
upon the system architecture used. For example:
#if __TANDEM_ARCH_ == 2
printf ("TNS/E\n");
#endif
_TNS_E_TARGET Identifiers used by the TNS/E native C and C++
compilers; defined only for the TNS/E native C/C++
compilers.
_TNS_R_TARGET Identifiers used by the TNS/R native C and C++
compilers; defined only for the TNS/R native C/C++
compilers.
_WIN32_HOST Identifiers required for compiling on a PC running
the Windows operating system.
_XOPEN_SOURCE Identifiers required or permitted by the XPG4
specification
_XOPEN_SOURCE_EXTENDED Identifiers specified in the XPG4.2 specification as
extensions to the XPG4 specification
Table 12-3. Predefined Feature-Test Macros (page 3 of 3)
Macro What It Defines