Certain symbols in this volume of IEEE Std 1003.1-2001 are defined in headers (see the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 13, Headers). Some of those headers could also define symbols other than those defined by IEEE Std 1003.1-2001, potentially conflicting with symbols used by the application. Also, IEEE Std 1003.1-2001 defines symbols that are not permitted by other standards to appear in those headers without some control on the visibility of those symbols.
Symbols called "feature test macros" are used to control the visibility of symbols that might be included in a header. Implementations, future versions of IEEE Std 1003.1-2001, and other standards may define additional feature test macros.
In the compilation of an application that #defines a feature test macro specified by IEEE Std 1003.1-2001, no header defined by IEEE Std 1003.1-2001 shall be included prior to the definition of the feature test macro. This restriction also applies to any implementation-provided header in which these feature test macros are used. If the definition of the macro does not precede the #include, the result is undefined.
Feature test macros shall begin with the underscore character ( '_' ).
A POSIX-conforming application should ensure that the feature test macro _POSIX_C_SOURCE is defined before inclusion of any header.
When an application includes a header described by IEEE Std 1003.1-2001, and when this feature test macro is defined to have the value 200112L:
All symbols required by IEEE Std 1003.1-2001 to appear when the header is included shall be made visible.
Symbols that are explicitly permitted, but not required, by IEEE Std 1003.1-2001 to appear in that header (including those in reserved name spaces) may be made visible.
Additional symbols not required or explicitly permitted by IEEE Std 1003.1-2001 to be in that header shall not be made visible, except when enabled by another feature test macro.
Identifiers in IEEE Std 1003.1-2001 may only be undefined using the #undef directive as described in Use and Implementation of Functions or The Name Space . These
#undef directives shall follow all #include directives of any header in IEEE Std 1003.1-2001.
[XSI] An XSI-conforming application should ensure that the feature test macro _XOPEN_SOURCE is defined with the value 600 before inclusion of any header. This is needed to enable the functionality described in The _POSIX_C_SOURCE Feature Test Macro and in addition to enable the XSI extension.
Since this volume of IEEE Std 1003.1-2001 is aligned with the ISO C standard, and since all functionality enabled by _POSIX_C_SOURCE set equal to 200112L is enabled by _XOPEN_SOURCE set equal to 600, there should be no need to define _POSIX_C_SOURCE if _XOPEN_SOURCE is so defined. Therefore, if _XOPEN_SOURCE is set equal to 600 and _POSIX_C_SOURCE is set equal to 200112L, the behavior is the same as if only _XOPEN_SOURCE is defined and set equal to 600. However, should _POSIX_C_SOURCE be set to a value greater than 200112L, the behavior is unspecified.
All identifiers in this volume of IEEE Std 1003.1-2001, except environ, are defined in at least one of the headers, as shown in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 13, Headers. When [XSI] _XOPEN_SOURCE or _POSIX_C_SOURCE is defined, each header defines or declares some identifiers, potentially conflicting with identifiers used by the application. The set of identifiers visible to the application consists of precisely those identifiers from the header pages of the included headers, as well as additional identifiers reserved for the implementation. In addition, some headers may make visible identifiers from other headers as indicated on the relevant header pages.
Implementations may also add members to a structure or union without controlling the visibility of those members with a feature test macro, as long as a user-defined macro with the same name cannot interfere with the correct interpretation of the program. The identifiers reserved for use by the implementation are described below:
Each identifier with external linkage described in the header section is reserved for use as an identifier with external linkage if the header is included.
Each macro described in the header section is reserved for any use if the header is included.
Each identifier with file scope described in the header section is reserved for use as an identifier with file scope in the same name space if the header is included.
The prefixes posix_, POSIX_, and _POSIX_ are reserved for use by IEEE Std 1003.1-2001 and other POSIX standards. Implementations may add symbols to the headers shown in the following table, provided the identifiers for those symbols begin with the corresponding reserved prefixes in the following table, and do not use the reserved prefixes posix_, POSIX_, or _POSIX_.
Header |
Prefix |
Suffix |
Complete |
---|---|---|---|
[AIO] <aio.h> |
aio_, lio_, AIO_, LIO_ |
|
|
<arpa/inet.h> |
in_, inet_ |
|
|
<ctype.h> |
to[a-z], is[a-z] |
|
|
<dirent.h> |
d_ |
|
|
<errno.h> |
E[0-9], E[A-Z] |
|
|
<fcntl.h> |
l_ |
|
|
<glob.h> |
gl_ |
|
|
<grp.h> |
gr_ |
|
|
<inttypes.h> |
|
|
int[0-9a-z_]*_t, |
|
|
|
uint[0-9a-z_]*_t |
<limits.h> |
|
_MAX, _MIN |
|
<locale.h> |
LC_[A-Z] |
|
|
[MSG] <mqueue.h> |
mq_, MQ_ |
|
|
[XSI] <ndbm.h> |
dbm_ |
|
|
<netdb.h> |
h_, n_, p_, s_ |
|
|
<net/if.h> |
if_ |
|
|
<netinet/in.h> |
in_, ip_, s_, sin_ |
|
|
[IP6] |
in6_, s6_, sin6_ |
|
|
[XSI] <poll.h> |
pd_, ph_, ps_ |
|
|
<pthread.h> |
pthread_, PTHREAD_ |
|
|
<pwd.h> |
pw_ |
|
|
<regex.h> |
re_, rm_ |
|
|
[PS] <sched.h> |
sched_, SCHED_ |
|
|
[SEM] <semaphore.h> |
sem_, SEM_ |
|
|
<signal.h> |
sa_, uc_, SIG[A-Z], SIG_[A-Z] |
|
|
[XSI] |
ss_, sv_ |
|
|
[RTS] |
si_, SI_, sigev_, SIGEV_, sival_ |
|
|
[XSI] <stropts.h> |
bi_, ic_, l_, sl_, str_ |
|
|
<stdint.h> |
|
|
int[0-9a-z_]*_t, |
|
|
|
uint[0-9a-z_]*_t |
<stdlib.h> |
str[a-z] |
|
|
<string.h> |
str[a-z], mem[a-z], wcs[a-z] |
|
|
[XSI] <sys/ipc.h> |
ipc_ |
|
key, pad, seq |
[MF] <sys/mman.h> |
shm_, MAP_, MCL_, MS_, PROT_ |
|
|
[XSI] <sys/msg.h> |
msg |
|
|
[XSI] <sys/resource.h> |
rlim_, ru_ |
|
|
<sys/select.h> |
fd_, fds_, FD_ |
|
|
[XSI] <sys/sem.h> |
sem |
|
sem |
[XSI] <sys/shm.h> |
shm |
|
|
<sys/socket.h> |
ss_, sa_, if_, ifc_, ifru_, infu_, ifra_, |
|
|
|
msg_, cmsg_, l_ |
|
|
<sys/stat.h> |
st_ |
|
|
[XSI] <sys/statvfs.h> |
f_ |
|
|
<sys/time.h> |
fds_, it_, tv_, FD_ |
|
|
<sys/times.h> |
tms_ |
|
|
[XSI] <sys/uio.h> |
iov_ |
|
UIO_MAXIOV |
<sys/un.h> |
sun_ |
|
|
<sys/utsname.h> |
uts_ |
|
|
[XSI] <sys/wait.h> |
si_, W[A-Z], P_ |
|
|
<termios.h> |
c_ |
|
|
<time.h> |
tm_ |
|
|
[TMR] |
clock_, timer_, it_, tv_, |
|
|
[TMR] |
CLOCK_, TIMER_ |
|
|
[XSI] <ucontext.h> |
uc_, ss_ |
|
|
[XSI] <ulimit.h> |
UL_ |
|
|
<utime.h> |
utim_ |
|
|
[XSI] <utmpx.h> |
ut_ |
_LVL, _TIME, |
|
|
|
_PROCESS |
|
<wchar.h> |
wcs[a-z] |
|
|
<wctype.h> |
is[a-z], to[a-z] |
|
|
<wordexp.h> |
we_ |
|
|
ANY header |
POSIX_, _POSIX_, posix_ |
_t |
|
If any header in the following table is included, macros with the prefixes shown may be defined. After the last inclusion of a given header, an application may use identifiers with the corresponding prefixes for its own purpose, provided their use is preceded by a #undef of the corresponding macro.
Header |
Prefix |
---|---|
[XSI] <dlfcn.h> |
RTLD_ |
<fcntl.h> |
F_, O_, S_ |
[XSI] <fmtmsg.h> |
MM_ |
<fnmatch.h> |
FNM_ |
[XSI] <ftw.h> |
FTW |
<glob.h> |
GLOB_ |
<inttypes.h> |
PRI[a-z], SCN[a-z] |
[XSI] <ndbm.h> |
DBM_ |
<net/if.h> |
IF_ |
<netinet/in.h> |
IMPLINK_, IN_, INADDR_, IP_, IPPORT_, IPPROTO_, SOCK_ |
[IP6] |
IPV6_, IN6_ |
<netinet/tcp.h> |
TCP_ |
[XSI] <nl_types.h> |
NL_ |
[XSI] <poll.h> |
POLL |
<regex.h> |
REG_ |
<signal.h> |
SA_, SIG_[0-9a-z_], |
[XSI] |
BUS_, CLD_, FPE_, ILL_, POLL_, SEGV_, SI_, SS_, SV_, TRAP_ |
<stdint.h> |
INT[0-9A-Z_]_MIN, INT[0-9A-Z_]_MAX, INT[0-9A-Z_]_C |
|
UINT[0-9A-Z_]_MIN, UINT[0-9A-Z_]_MAX, UINT[0-9A-Z_]_C |
[XSI] <stropts.h> |
FLUSH[A-Z], I_, M_, MUXID_R[A-Z], S_, SND[A-Z], STR |
[XSI] <syslog.h> |
LOG_ |
[XSI] <sys/ipc.h> |
IPC_ |
[XSI] <sys/mman.h> |
PROT_, MAP_, MS_ |
[XSI] <sys/msg.h> |
MSG[A-Z] |
[XSI] <sys/resource.h> |
PRIO_, RLIM_, RLIMIT_, RUSAGE_ |
[XSI] <sys/sem.h> |
SEM_ |
[XSI] <sys/shm.h> |
SHM[A-Z], SHM_[A-Z] |
[XSI] <sys/socket.h> |
AF_, CMSG_, MSG_, PF_, SCM_, SHUT_, SO |
<sys/stat.h> |
S_ |
[XSI] <sys/statvfs.h> |
ST_ |
[XSI] <sys/time.h> |
FD_, ITIMER_ |
[XSI] <sys/uio.h> |
IOV_ |
[XSI] <sys/wait.h> |
BUS_, CLD_, FPE_, ILL_, POLL_, SEGV_, SI_, TRAP_ |
<termios.h> |
V, I, O, TC, B[0-9] (See below.) |
<wordexp.h> |
WRDE_ |
The following reserved names are used as exact matches for <termios.h>:
[XSI] CBAUD |
EXTB |
VDSUSP |
DEFECHO |
FLUSHO |
VLNEXT |
ECHOCTL |
LOBLK |
VREPRINT |
ECHOKE |
PENDIN |
VSTATUS |
ECHOPRT |
SWTCH |
VWERASE |
EXTA |
VDISCARD |
|
The following identifiers are reserved regardless of the inclusion of headers:
All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use by the implementation.
All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary identifier and tag name spaces.
All identifiers in the table below are reserved for use as identifiers with external linkage. Some of these identifiers do not appear in this volume of IEEE Std 1003.1-2001, but are reserved for future use by the ISO C standard.
|
|
|
|
|
All functions and external identifiers defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 13, Headers are reserved for use as identifiers with external linkage.
All the identifiers defined in this volume of IEEE Std 1003.1-2001 that have external linkage are always reserved for use as identifiers with external linkage.
No other identifiers are reserved.
Applications shall not declare or define identifiers with the same name as an identifier reserved in the same context. Since macro names are replaced whenever found, independent of scope and name space, macro names matching any of the reserved identifier names shall not be defined by an application if any associated header is included.
Except that the effect of each inclusion of <assert.h> depends on the definition of NDEBUG, headers may be included in any order, and each may be included more than once in a given scope, with no difference in effect from that of being included only once.
If used, the application shall ensure that a header is included outside of any external declaration or definition, and it shall be first included before the first reference to any type or macro it defines, or to any function or object it declares. However, if an identifier is declared or defined in more than one header, the second and subsequent associated headers may be included after the initial reference to the identifier. Prior to the inclusion of a header, the application shall not define any macros with names lexically identical to symbols defined by that header.