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

Table Of Contents
Introduction to HP C and C++ for NonStop Systems
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
1-20
Complying With Standards
X/Open Common Applications Environment (CAE) Specification, System Interface
Definitions, Issue 4, Version 2, 1994.
ISO/IEC 9945-1:1990, Information Technology—Portable Operating System
Interface (POSIX) — Part 1: System Application Program Interface (API)
[C Language].
ISO/IEC DIS 9945-2:1992, Information Technology—Portable Operating System
Interface (POSIX) — Part 2: Shell and Utilities
The OSS environment provides all the function calls specified in the POSIX.1 standard,
and many of the function calls specified in the POSIX.2 standard and the XPG4
specification. Before using a function that is not part of the ISO/ANSI C standard,
check to make sure that the OSS environment provides that function.
Feature-test macros enable you to check how well a program complies with these
standards. The C header files contain definitions required by the ISO/ANSI C standard,
the POSIX.1 standard, the POSIX.2 standard, the XPG4 specification, and the XPG4.2
specification. You control the visibility of these definitions with feature-test macros. If a
program does not conform to the standard or specification controlled by a feature-test
macro, the compiler issues error and warning messages.
The five feature-test macros that apply to standards compliance are:
The XPG4 specification includes the identifiers required by the POSIX.1 and POSIX.2
standards. Therefore, specifying the _XOPEN_SOURCE macro automatically includes
the identifiers included by the _POSIX_C_SOURCE=2 macro.
For more details about feature-test macros, see Feature-Test Macros on page 12-13.
_POSIX_C_SOURCE=1 Makes visible identifiers required or permitted by
the POSIX.1 standard.
_POSIX_C_SOURCE=2 Makes visible identifiers required or permitted by
the POSIX.1 and POSIX.2 standards.
_XOPEN_SOURCE Makes visible identifiers required or permitted by
the XPG4 specification. Represents the OSS
compile default.
_XOPEN_SOURCE_EXTENDED=1 Makes visible identifiers specified in the XPG4.2
specification as extensions to the XPG4
specification.
_TANDEM_SOURCE Makes visible the identifiers required or permitted
by extensions made by HP. Represents the
Guardian compile default for the TNS C compiler.
Includes some of the identifiers required by the
XPG4 specification, in addition to POSIX.1 and
POSIX.2 standards.