DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Complying with standard C

Standard headers

The standard headers are as follows:

   assert.h         locale.h         stddef.h
   ctype.h          math.h           stdio.h
   errno.h          setjmp.h         stdlib.h
   float.h          signal.h         string.h
   limits.h         stdarg.h         time.h

Most implementations will provide more headers, but a strictly conforming ANSI C program can only use these.

Other standards disagree slightly regarding the contents of some of these headers. For example, POSIX (IEEE 1003.1) specifies that fdopen is declared in stdio.h. To allow these two standards to coexist, POSIX requires the macro _POSIX_SOURCE to be #defined prior to the inclusion of any header to guarantee that these additional names exist. (In actuality, the POSIX committee believes that almost the opposite will occur: that _POSIX_SOURCE will be used to limit headers to only those names POSIX describes, and that, by default, headers will contain even more names than POSIX specifies.) X/Open, in its Portability Guide, has also used this macro scheme for its extensions. X/Open's macro is _XOPEN_SOURCE. The following section describes why this scheme is sufficient.

ANSI C requires the standard headers to be both self-sufficient and idempotent. No standard header needs any other header to be #included before or after it, and each standard header can be #included more than once without causing problems. The Standard also requires that its headers be #included only in safe contexts so that the names used in the headers are guaranteed to remain unchanged.


Next topic: Names reserved for implementation use
Previous topic: Balancing process

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005