HP-UX Reference (11i v2 04/09) - 5 Miscellaneous Topics (vol 9)

s
stdsyms(5) stdsyms(5)
NAME
stdsyms - description of named defines and other specifications for namespace from HP-UX header files
DESCRIPTION
stdsyms is a description of "named defines" and other specifications that must be set by the application
to obtain the appropriate namespace from the HP-UX header files.
HP-UX header files are organized in a manner that allows for only a subset of the symbols available in
that header file to be visible to an application that conforms to a specific standard. The ANSI-C,
POSIX.1, POSIX.2, and XPG4 standards each reserve a certain set of symbols for that standard’s
namespace. In addition, the HP-UX implementation of XPG3 and the "OSF AES/OS" provides for a clean
namespace although this is not a specific requirement of those standards.
The following rules apply in determining what symbols are reserved for any standard. These symbols are
reserved for the standard and for use by the implementation, and must be either avoided altogether, or
used exactly as defined by the specified standard.
All symbols defined by the desired standard are reserved. Refer to the appropriate standards docu-
mentation for a complete list of reserved symbols.
All symbols beginning with an underscore followed by another underscore or an uppercase letter are
reserved for the implementation.
All external identifiers beginning with an underscore are reserved for the implementation.
The following is a list of feature test macros which must be defined to obtain the appropriate namespace
from the header files.
__STDC__
This symbol is automatically defined by the ANSI-C pre-processor
(/opt/langtools/lib/cpp.ansi
) and is automatically defined when specifying an
ANSI-C compile (
cc -Aa). Using the strict ANSI option -Aa requests a pure ANSI-C
namespace, which is the smallest subset of the HP-UX namespace available. The -Aa
option also enables the inclusion of ANSI-C-style function prototypes for increased type
checking. Note that the default namespace when using the -Aa option is the ANSI-C
namespace; therefore a broader namespace must be requested if it is desired.
_POSIX_SOURCE
As documented in the IEEE POSIX.1 standard, the programmer is required to define the
_POSIX_SOURCE feature test macro to obtain the POSIX.1 namespace and POSIX.1
functionality. This feature test macro can be defined, either by using compiler options (
-
D_POSIX_SOURCE) or by using
#define directives in the source files before any
#include directives. Note that the default POSIX namespace is the POSIX.1-1990
namespace. It is necessary to define the _POSIX1_1988 feature test macro in addition
to the _POSIX_SOURCE macro in order to obtain the POSIX.1-1988 namespace.
_POSIX_C_SOURCE
As documented in the IEEE POSIX.2 standard, the programmer is required to define the
_POSIX_C_SOURCE feature test macro with a value of 2 to obtain the POSIX.1 and
POSIX.2 namespaces and functionality. This feature test macro can be defined, either by
using compiler options (-D_POSIX_C_SOURCE=2) or by using #define directives in
the source files before any #include directives. This macro is also automatically
defined in the XPG4 X/Open namespace (that is, whenever _XOPEN_SOURCE and
_XPG4 are defined without defining _XPG2 or _XPG3).
_XOPEN_SOURCE
As documented in the XPG3 and XPG4 standards, the programmer is required to define
the _XOPEN_SOURCE feature test macro to obtain X/Open functionality. This feature
test macro can be defined, either by using compiler options (-D_XOPEN_SOURCE)orby
using #define directives in the source files before any #include directives.
Although XPG3 does not specify any namespace pollution rules, XPG4 has instituted such
rules. Therefore, the HP-UX operating system provides clean namespaces whenever
_XOPEN_SOURCE is defined.
The current default X/Open namespace is that corresponding to XPG3. To request other
versions of the X/Open namespace, define
_XPG2 or _XPG4 in conjunction with
_XOPEN_SOURCE.
HP-UX 11i Version 2: September 2004 1 Hewlett-Packard Company Section 5347