C/C++ Programmer's Guide (G06.25+)
Preprocessor Directives and Macros
HP C/C++ Programmer’s Guide for NonStop Servers—429301-002
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
#if __TANDEM_ARCH_ != 0
printf ("Native system, not TNS\n");
#endif
The _IGNORE_LOCALE macro selects macros that support only the C/POSIX locale
instead of internationalized functions that support multiple locales. The
_IGNORE_LOCALE macro affects functions in the ctypeh or ctype.h header file.
The native compilers provide four additional feature-test macros. Unlike the previously
described feature-test macros, these four macros do not determine whether a
particular set of features will be included from header files. Instead, these feature-test
macros are intended to isolate code by the environment in which it can be run.
The _IEEE_FLOAT macro is automatically defined by the native C and C++ compilers
if IEEE floating-point format has been specified. For more information, see the pragma
IEEE_FLOAT on page 13-45.