From f125c76932e00adcde009741fa2e1770775832cc Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Mon, 8 Feb 2016 13:03:17 +0100 Subject: [PATCH] feature_test_macros.7: Add a summary of some FTM key points Signed-off-by: Michael Kerrisk --- man7/feature_test_macros.7 | 62 +++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/man7/feature_test_macros.7 b/man7/feature_test_macros.7 index 09902f821..7c0000a4f 100644 --- a/man7/feature_test_macros.7 +++ b/man7/feature_test_macros.7 @@ -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.