Next: C99 features assumed by Gnulib, Up: Portability guidelines [Contents][Index]
Currently Gnulib assumes at least a freestanding C99 compiler, possibly operating with a C library that predates C99; with time this assumption will likely be strengthened to later versions of the C standard. Old platforms currently supported include AIX 6.1, HP-UX 11i v1 and Solaris 10, though these platforms are rarely tested. Gnulib itself is so old that it contains many fixes for obsolete platforms, fixes that may be removed in the future.
Because of the freestanding C99 assumption, Gnulib code can include
<float.h>
, <limits.h>
, <stdarg.h>
,
<stddef.h>
, and <stdint.h>
unconditionally; <stdbool.h>
is also in the C99 freestanding
list but is obsolescent as of C23. Gnulib code can also assume the existence
of <ctype.h>
, <errno.h>
, <fcntl.h>
,
<locale.h>
, <signal.h>
, <stdio.h>
,
<stdlib.h>
, <string.h>
, and <time.h>
. Similarly,
many modules include <sys/types.h>
even though it’s not even in
C11; that’s OK since <sys/types.h>
has been around nearly
forever.
Even if the include files exist, they may not conform to the C standard.
However, GCC has a fixincludes
script that attempts to fix most
conformance problems. Gnulib currently assumes include files
largely conform to C99 or better. People still using ancient hosts
should use fixincludes or fix their include files manually.
Even if the include files conform, the library itself may not.
For example, strtod
and mktime
have some bugs on some platforms.
You can work around some of these problems by requiring the relevant
modules, e.g., the Gnulib mktime
module supplies a working and
conforming mktime
.