Users that want to write programs that are portable according to the XPG4 Version 2 standard must set the _XOPEN_SOURCE macro as well as the
_XOPEN_SOURCE_EXTENDED macro to the value 1. The identifiers required and expressly permitted by the XPG4 Version 2 standard are made visible in this manner. These macros must be set before the first header file is included. This can be done either during compilation by specifying the corresponding compiler option or in the source code using #define statements.
XPG4 Version 2 defined identifiers are undefined only if the #undef
statement has been specified (see also section “Functions and macros” ). These #undef
statements must be called before the #include
statements.
When the _XOPEN_SOURCE
macro is set to 500, only the identifiers required or explicitly allowed by the XPG4 Version 2 standard are made visible. The _XOPEN_SOURCE_EXTENDED
macro is ignored in this case. When the _XOPEN_SOURCE
macro is not set to 500 but the _XOPEN_SOURCE_EXTENDED
is set to 1, then only the identifiers contained in the XPG4 Version 2 standard are visible.
_XOPEN_SOURCE_EXTENDED
can be defined for the compilation run. Therefore, to support maximum portability, it is advisable to ensure that _XOPEN_SOURCE_EXTENDED
is set to 1 in applications by using a compiler option or by entering a #define
statement before the first #include
statement in the source code.
Applications which use functionality that is marked in this manual as an extension (indicated by BS2000 or Extension) are not strictly XPG4 Version 2-conformant or ISO C-conformant.
To write programs that are portable according to the XPG5 standard, the _XOPEN_SOURCE
macro must be set to 500. The _XOPEN_SOURCE_EXTENDED
macro is ignored in this case. Not all function groups and header files contained in the XPG5 standard are realized in this implementation (for example, there is no asynchronous I/O and no real time functions). The corresponding function test macros are set to -1 in the header file <unistd.h>.