Next: , Previous: , Up: Brief Overview   [Contents][Index]

1.5 Portability guidelines

Gnulib code is intended to be portable to a wide variety of platforms, not just GNU platforms. Gnulib typically attempts to support a platform as long as it is still supported by its provider, even if the platform is not the latest version. See Target Platforms.

Many Gnulib modules exist so that applications need not worry about undesirable variability in implementations. For example, an application that uses the malloc module need not worry about malloc (0) returning a null pointer on some Standard C platforms; and glob users need not worry about glob silently omitting symbolic links to nonexistent files on some platforms that do not conform to POSIX.

Gnulib code is intended to port without problem to new hosts, e.g., hosts conforming to recent C and POSIX standards. Hence Gnulib code should avoid using constructs that these newer standards no longer require, without first testing for the presence of these constructs. For example, because C11 made variable length arrays optional, Gnulib code should avoid them unless it first uses the vararrays module to check whether they are supported.

The following subsections discuss some exceptions and caveats to the general Gnulib portability guidelines.