feature_test_macros.7: Add a summary of some FTM key points

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2016-02-08 13:03:17 +01:00
parent b0da7b8b76
commit f125c76932
1 changed files with 61 additions and 1 deletions

View File

@ -122,10 +122,70 @@ This format is employed in cases where only a single
feature test macro can be used to expose the function
declaration, and that macro is not defined by default.
.SS Feature test macros understood by glibc
The following paragraphs explain how feature test macros are handled
The paragraphs below explain how feature test macros are handled
in Linux glibc 2.\fIx\fP,
.I x
> 0.
First, though a summary of a few details for the impatient:
.IP * 3
The macros that you most likely need to use in modern source code are
.BR _POSIX_C_SOURCE
(for definitions from various versions of POSIX.1),
.BR _XOPEN_SOURCE
(fof definitions from various versions of SUS),
.BR _GNU_SOURCE
(for GNU and/or Linux specific stuff), and
.BR _DEFAULT_SOURCE
(to get definitions that would normally be provided by default).
.IP *
Defining
.BR _XOPEN_SOURCE
with a value of 600 or greater produces the same effects as defining
.BR _POSIX_C_SOURCE
with a value of 200112L or greater.
Where one sees
.RS
.nf
_POSIX_C_SOURCE >= 200112L
.fi
.RE
.IP
in the feature test macro requirements in the SYNOPSIS of a man page,
it is implicit that the following has the same effect:
.RS
.nf
_XOPEN_SOURCE >= 600
.fi
.RE
.IP *
Defining
.BR _XOPEN_SOURCE
with a value of 700 or greater produces the same effects as defining
.BR _POSIX_C_SOURCE
with a value of 200809L or greater.
Where one sees
.RS
.nf
_POSIX_C_SOURCE >= 200809L
.fi
.RE
.IP
in the feature test macro requirements in the SYNOPSIS of a man page,
it is implicit that the following has the same effect:
.RS
.nf
_XOPEN_SOURCE >= 700
.fi
.RE
.\" The details in glibc 2.0 are simpler, but combining a
.\" a description of them with the details in later glibc versions
.\" would make for a complicated description.