{
    "mode": "man",
    "parameter": "FEATURE_TEST_MACROS",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/FEATURE_TEST_MACROS/7/json",
    "generated": "2026-05-30T06:10:47Z",
    "sections": {
        "NAME": {
            "content": "featuretestmacros - feature test macros\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Feature  test macros allow the programmer to control the definitions that are exposed by sys‐\ntem header files when a program is compiled.\n\nNOTE: In order to be effective, a feature test macro must be  defined  before  including  any\nheader  files.   This  can be done either in the compilation command (cc -DMACRO=value) or by\ndefining the macro within the source code before including any headers.  The requirement that\nthe  macro  must  be defined before including any header file exists because header files may\nfreely include one another.   Thus,  for  example,  in  the  following  lines,  defining  the\nGNUSOURCE  macro  may  have  no  effect  because the header <abc.h> itself includes <xyz.h>\n(POSIX explicitly allows this):\n\n#include <abc.h>\n#define GNUSOURCE\n#include <xyz.h>\n\nSome feature test macros are useful for creating portable applications,  by  preventing  non‐\nstandard definitions from being exposed.  Other macros can be used to expose nonstandard def‐\ninitions that are not exposed by default.\n\nThe precise effects of each of the feature test macros described below can be ascertained  by\ninspecting  the <features.h> header file.  Note: applications do not need to directly include\n<features.h>; indeed, doing so is actively discouraged.  See NOTES.\n",
            "subsections": [
                {
                    "name": "Specification of feature test macro requirements in manual pages",
                    "content": "When a function requires that a feature test macro is defined, the manual page SYNOPSIS typi‐\ncally includes a note of the following form (this example from the acct(2) manual page):\n\n#include <unistd.h>\n\nint acct(const char *filename);\n\nFeature Test Macro Requirements for glibc (see\nfeaturetestmacros(7)):\n\nacct(): BSDSOURCE || (XOPENSOURCE && XOPENSOURCE < 500)\n\nThe  ||  means  that in order to obtain the declaration of acct(2) from <unistd.h>, either of\nthe following macro definitions must be made before including any header files:\n\n#define BSDSOURCE\n#define XOPENSOURCE        /* or any value < 500 */\n\nAlternatively, equivalent definitions can be included in the compilation command:\n\ncc -DBSDSOURCE\ncc -DXOPENSOURCE           # Or any value < 500\n\nNote that, as described below, some feature test macros are defined by default,  so  that  it\nmay not always be necessary to explicitly specify the feature test macro(s) shown in the SYN‐\nOPSIS.\n\nIn a few cases, manual pages use a shorthand for expressing the feature test  macro  require‐\nments (this example from readahead(2)):\n\n#define GNUSOURCE\n#include <fcntl.h>\n\nssizet readahead(int fd, off64t *offset, sizet count);\n\nThis format is employed in cases where only a single feature test macro can be used to expose\nthe function declaration, and that macro is not defined by default.\n"
                },
                {
                    "name": "Feature test macros understood by glibc",
                    "content": "The paragraphs below explain how feature test macros are handled in Linux glibc 2.x, x > 0.\n\nFirst, though a summary of a few details for the impatient:\n\n*  The macros that you most likely need to use in modern source code are POSIXCSOURCE (for\ndefinitions from various versions of POSIX.1), XOPENSOURCE (for definitions from various\nversions of SUS), GNUSOURCE (for GNU and/or Linux specific stuff),  and  DEFAULTSOURCE\n(to get definitions that would normally be provided by default).\n\n*  Certain  macros are defined with default values.  Thus, although one or more macros may be\nindicated as being required in the SYNOPSIS of a man page, it may not be necessary to  de‐\nfine them explicitly.  Full details of the defaults are given later in this man page.\n\n*  Defining  XOPENSOURCE with a value of 600 or greater produces the same effects as defin‐\ning POSIXCSOURCE with a value of 200112L or greater.  Where one sees\n\nPOSIXCSOURCE >= 200112L\n\nin the feature test macro requirements in the SYNOPSIS of a man page, it is implicit  that\nthe following has the same effect:\n\nXOPENSOURCE >= 600\n\n*  Defining  XOPENSOURCE with a value of 700 or greater produces the same effects as defin‐\ning POSIXCSOURCE with a value of 200809L or greater.  Where one sees\n\nPOSIXCSOURCE >= 200809L\n\nin the feature test macro requirements in the SYNOPSIS of a man page, it is implicit  that\nthe following has the same effect:\n\nXOPENSOURCE >= 700\n\nLinux glibc understands the following feature test macros:\n\nSTRICTANSI\nISO Standard C.  This macro is implicitly defined by gcc(1) when invoked with, for ex‐\nample, the -std=c99 or -ansi flag.\n\nPOSIXCSOURCE\nDefining this macro causes header files to expose definitions as follows:\n\n•  The value 1 exposes definitions conforming to POSIX.1-1990 and ISO C (1990).\n\n•  The value 2 or greater additionally exposes definitions for POSIX.2-1992.\n\n•  The value 199309L or greater additionally exposes definitions for  POSIX.1b  (real-\ntime extensions).\n\n•  The  value  199506L  or  greater  additionally  exposes  definitions  for  POSIX.1c\n(threads).\n\n•  (Since glibc 2.3.3) The value 200112L or greater additionally  exposes  definitions\ncorresponding to the POSIX.1-2001 base specification (excluding the XSI extension).\nThis value also causes C95 (since glibc 2.12) and C99 (since glibc  2.10)  features\nto be exposed (in other words, the equivalent of defining ISOC99SOURCE).\n\n•  (Since  glibc  2.10)  The value 200809L or greater additionally exposes definitions\ncorresponding to the POSIX.1-2008 base specification (excluding the XSI extension).\n\nPOSIXSOURCE\nDefining this obsolete macro with any value is equivalent to defining  POSIXCSOURCE\nwith the value 1.\n\nSince  this  macro  is obsolete, its usage is generally not documented when discussing\nfeature test macro requirements in the man pages.\n\nXOPENSOURCE\nDefining this macro causes header files to expose definitions as follows:\n\n•  Defining with any value exposes definitions conforming  to  POSIX.1,  POSIX.2,  and\nXPG4.\n\n•  The value 500 or greater additionally exposes definitions for SUSv2 (UNIX 98).\n\n•  (Since  glibc  2.2)  The  value 600 or greater additionally exposes definitions for\nSUSv3 (UNIX 03; i.e., the POSIX.1-2001 base specification plus the  XSI  extension)\nand C99 definitions.\n\n•  (Since  glibc  2.10)  The value 700 or greater additionally exposes definitions for\nSUSv4 (i.e., the POSIX.1-2008 base specification plus the XSI extension).\n\nIf STRICTANSI is not defined, or XOPENSOURCE is defined with  a  value  greater\nthan  or  equal to 500 and neither POSIXSOURCE nor POSIXCSOURCE is explicitly de‐\nfined, then the following macros are implicitly defined:\n\n•  POSIXSOURCE is defined with the value 1.\n\n•  POSIXCSOURCE is defined, according to the value of XOPENSOURCE:\n\nXOPENSOURCE < 500\nPOSIXCSOURCE is defined with the value 2.\n\n500 <= XOPENSOURCE < 600\nPOSIXCSOURCE is defined with the value 199506L.\n\n600 <= XOPENSOURCE < 700\nPOSIXCSOURCE is defined with the value 200112L.\n\n700 <= XOPENSOURCE (since glibc 2.10)\nPOSIXCSOURCE is defined with the value 200809L.\n\nIn addition, defining XOPENSOURCE with a value of 500 or greater produces  the  same\neffects as defining XOPENSOURCEEXTENDED.\n\nXOPENSOURCEEXTENDED\nIf this macro is defined, and XOPENSOURCE is defined, then expose definitions corre‐\nsponding to the XPG4v2 (SUSv1) UNIX extensions (UNIX 95).  Defining XOPENSOURCE with\na  value  of  500  or more also produces the same effect as defining XOPENSOURCEEX‐‐\nTENDED.  Use of XOPENSOURCEEXTENDED in new source code should be avoided.\n\nSince defining XOPENSOURCE with a value of 500 or more has the same effect as defin‐\ning  XOPENSOURCEEXTENDED, the latter (obsolete) feature test macro is generally not\ndescribed in the SYNOPSIS in man pages.\n\nISOC99SOURCE (since glibc 2.1.3)\nExposes declarations consistent with the ISO C99 standard.\n\nEarlier glibc 2.1.x versions recognized an equivalent macro named ISOC9XSOURCE  (be‐\ncause  the  C99 standard had not then been finalized).  Although the use of this macro\nis obsolete, glibc continues to recognize it for backward compatibility.\n\nDefining ISOC99SOURCE also exposes ISO C (1990)  Amendment  1  (\"C95\")  definitions.\n(The primary change in C95 was support for international character sets.)\n\nInvoking the C compiler with the option -std=c99 produces the same effects as defining\nthis macro.\n\nISOC11SOURCE (since glibc 2.16)\nExposes declarations consistent with the ISO C11 standard.  Defining this  macro  also\nenables C99 and C95 features (like ISOC99SOURCE).\n\nInvoking the C compiler with the option -std=c11 produces the same effects as defining\nthis macro.\n\nLARGEFILE64SOURCE\nExpose definitions for the alternative API specified by the LFS (Large File Summit) as\na   \"transitional   extension\"   to  the  Single  UNIX  Specification.   (See  ⟨http:/\n/opengroup.org/platform/lfs.html⟩.)  The alternative API consists of a set of new  ob‐\njects  (i.e.,  functions  and types) whose names are suffixed with \"64\" (e.g., off64t\nversus offt, lseek64() versus lseek(), etc.).  New programs should  not  employ  this\nmacro; instead FILEOFFSETBITS=64 should be employed.\n\nLARGEFILESOURCE\nThis  macro  was historically used to expose certain functions (specifically fseeko(3)\nand ftello(3)) that address limitations of earlier APIs (fseek(3) and  ftell(3))  that\nuse  long  for file offsets.  This macro is implicitly defined if XOPENSOURCE is de‐\nfined with a value greater than or equal to 500.  New programs should not employ  this\nmacro; defining XOPENSOURCE as just described or defining FILEOFFSETBITS with the\nvalue 64 is the preferred mechanism to achieve the same result.\n\nFILEOFFSETBITS\nDefining this macro with the value 64  automatically  converts  references  to  32-bit\nfunctions and data types related to file I/O and filesystem operations into references\nto their 64-bit counterparts.  This is useful for performing I/O on large files  (>  2\nGigabytes) on 32-bit systems.  (Defining this macro permits correctly written programs\nto use large files with only a recompilation being required.)\n\n64-bit systems naturally permit file sizes greater than 2 Gigabytes, and on those sys‐\ntems this macro has no effect.\n\nBSDSOURCE (deprecated since glibc 2.20)\nDefining  this  macro with any value causes header files to expose BSD-derived defini‐\ntions.\n\nIn glibc versions up to and including 2.18, defining this macro also causes BSD  defi‐\nnitions  to  be  preferred  in some situations where standards conflict, unless one or\nmore of SVIDSOURCE, POSIXSOURCE, POSIXCSOURCE, XOPENSOURCE, XOPENSOURCEEX‐‐\nTENDED,  or  GNUSOURCE  is  defined,  in  which case BSD definitions are disfavored.\nSince glibc 2.19, BSDSOURCE no longer causes BSD definitions to be preferred in case\nof conflicts.\n\nSince  glibc  2.20,  this macro is deprecated.  It now has the same effect as defining\nDEFAULTSOURCE, but generates a compile-time warning (unless DEFAULTSOURCE is  also\ndefined).   Use  DEFAULTSOURCE  instead.  To allow code that requires BSDSOURCE in\nglibc 2.19 and earlier and DEFAULTSOURCE in glibc 2.20 and later to compile  without\nwarnings, define both BSDSOURCE and DEFAULTSOURCE.\n\nSVIDSOURCE (deprecated since glibc 2.20)\nDefining this macro with any value causes header files to expose System V-derived def‐\ninitions.  (SVID == System V Interface Definition; see standards(7).)\n\nSince glibc 2.20, this macro is deprecated in the same fashion as BSDSOURCE.\n\nDEFAULTSOURCE (since glibc 2.19)\nThis macro can be defined to ensure that the \"default\" definitions are  provided  even\nwhen  the  defaults would otherwise be disabled, as happens when individual macros are\nexplicitly defined, or the compiler is invoked in one of its \"standard\"  modes  (e.g.,\ncc -std=c99).   Defining  DEFAULTSOURCE  without defining other individual macros or\ninvoking the compiler in one of its \"standard\" modes has no effect.\n\nThe \"default\" definitions comprise those required by POSIX.1-2008 and ISO C99, as well\nas  various  definitions  originally derived from BSD and System V.  On glibc 2.19 and\nearlier, these defaults were approximately equivalent to explicitly defining the  fol‐\nlowing:\n\ncc -DBSDSOURCE -DSVIDSOURCE -DPOSIXCSOURCE=200809\n\nATFILESOURCE (since glibc 2.4)\nDefining  this  macro  with  any value causes header files to expose declarations of a\nrange of functions with the suffix \"at\"; see openat(2).  Since glibc 2.10, this  macro\nis  also implicitly defined if POSIXCSOURCE is defined with a value greater than or\nequal to 200809L.\n\nGNUSOURCE\nDefining this macro  (with  any  value)  implicitly  defines  ATFILESOURCE,  LARGE‐‐\nFILE64SOURCE,  ISOC99SOURCE, XOPENSOURCEEXTENDED, POSIXSOURCE, POSIXCSOURCE\nwith the value 200809L (200112L in glibc versions before 2.10; 199506L in  glibc  ver‐\nsions  before  2.5;  199309L  in glibc versions before 2.1) and XOPENSOURCE with the\nvalue 700 (600 in glibc versions before 2.10; 500 in glibc versions before  2.2).   In\naddition, various GNU-specific extensions are also exposed.\n\nSince glibc 2.19, defining GNUSOURCE also has the effect of implicitly defining DE‐‐\nFAULTSOURCE.  In glibc versions before 2.20, defining GNUSOURCE also had the effect\nof implicitly defining BSDSOURCE and SVIDSOURCE.\n\nREENTRANT\nHistorically, on various C libraries it was necessary to define this macro in all mul‐\ntithreaded code.  (Some C libraries may still require this.)   In  glibc,  this  macro\nalso exposed definitions of certain reentrant functions.\n\nHowever,  glibc  has  been thread-safe by default for many years; since glibc 2.3, the\nonly effect of defining REENTRANT has been to enable one or two of the same  declara‐\ntions  that  are  also  enabled by defining POSIXCSOURCE with a value of 199606L or\ngreater.\n\nREENTRANT is now obsolete.  In glibc 2.25 and later, defining REENTRANT  is  equiva‐\nlent  to  defining  POSIXCSOURCE with the value 199606L.  If a higher POSIX confor‐\nmance  level  is  selected  by  any  other  means  (such  as  POSIXCSOURCE  itself,\nXOPENSOURCE,  DEFAULTSOURCE,  or GNUSOURCE), then defining REENTRANT has no ef‐\nfect.\n\nThis macro is automatically defined if one compiles with cc -pthread.\n\nTHREADSAFE\nSynonym for the (deprecated) REENTRANT, provided for compatibility  with  some  other\nimplementations.\n\nFORTIFYSOURCE (since glibc 2.3.4)\nDefining this macro causes some lightweight checks to be performed to detect some buf‐\nfer overflow errors when employing various string and  memory  manipulation  functions\n(for example, memcpy(3), memset(3), stpcpy(3), strcpy(3), strncpy(3), strcat(3), strn‐‐\ncat(3), sprintf(3), snprintf(3), vsprintf(3), vsnprintf(3), gets(3), and wide  charac‐\nter variants thereof).  For some functions, argument consistency is checked; for exam‐\nple, a check is made that open(2) has been supplied with  a  mode  argument  when  the\nspecified  flags  include  OCREAT.   Not  all problems are detected, just some common\ncases.\n\nIf FORTIFYSOURCE is set to 1, with  compiler  optimization  level  1  (gcc -O1)  and\nabove, checks that shouldn't change the behavior of conforming programs are performed.\nWith FORTIFYSOURCE set to 2, some more checking is added, but some  conforming  pro‐\ngrams might fail.\n\nSome  of  the checks can be performed at compile time (via macros logic implemented in\nheader files), and result in compiler warnings; other checks take place at  run  time,\nand result in a run-time error if the check fails.\n\nUse of this macro requires compiler support, available with gcc(1) since version 4.0.\n"
                },
                {
                    "name": "Default definitions, implicit definitions, and combining definitions",
                    "content": "If  no feature test macros are explicitly defined, then the following feature test macros are\ndefined by default: BSDSOURCE (in glibc 2.19 and earlier), SVIDSOURCE (in glibc 2.19  and\nearlier),  DEFAULTSOURCE  (since  glibc  2.19),  POSIXSOURCE, and POSIXCSOURCE=200809L\n(200112L in glibc versions before 2.10; 199506L in glibc  versions  before  2.4;  199309L  in\nglibc versions before 2.1).\n\nIf  any of STRICTANSI, ISOC99SOURCE, ISOC11SOURCE (since glibc 2.18), POSIXSOURCE,\nPOSIXCSOURCE,  XOPENSOURCE,  XOPENSOURCEEXTENDED  (in  glibc   2.11   and   earlier),\nBSDSOURCE  (in  glibc 2.19 and earlier), or SVIDSOURCE (in glibc 2.19 and earlier) is ex‐\nplicitly defined, then BSDSOURCE, SVIDSOURCE, and DEFAULTSOURCE are not defined by  de‐\nfault.\n\nIf  POSIXSOURCE  and POSIXCSOURCE are not explicitly defined, and either STRICTANSI\nis not defined or XOPENSOURCE is defined with a value of 500 or more, then\n\n*  POSIXSOURCE is defined with the value 1; and\n\n*  POSIXCSOURCE is defined with one of the following values:\n\n•  2, if XOPENSOURCE is defined with a value less than 500;\n\n•  199506L, if XOPENSOURCE is defined with a value greater than or equal to 500 and less\nthan 600; or\n\n•  (since  glibc  2.4)  200112L,  if XOPENSOURCE is defined with a value greater than or\nequal to 600 and less than 700.\n\n•  (Since glibc 2.10) 200809L, if XOPENSOURCE is defined with a value  greater  than  or\nequal to 700.\n\n•  Older  versions  of  glibc  do  not  know  about  the  values  200112L  and 200809L for\nPOSIXCSOURCE, and the setting of this macro will depend on the glibc version.\n\n•  If XOPENSOURCE is undefined, then the setting of POSIXCSOURCE depends on the glibc\nversion:  199506L,  in  glibc  versions  before  2.4; 200112L, in glibc 2.4 to 2.9; and\n200809L, since glibc 2.10.\n\nMultiple macros can be defined; the results are additive.\n"
                }
            ]
        },
        "CONFORMING TO": {
            "content": "POSIX.1 specifies POSIXCSOURCE, POSIXSOURCE, and XOPENSOURCE.\n\nXOPENSOURCEEXTENDED was specified by XPG4v2 (aka SUSv1), but is not present in  SUSv2  and\nlater.  FILEOFFSETBITS is not specified by any standard, but is employed on some other im‐\nplementations.\n\nBSDSOURCE, SVIDSOURCE,  DEFAULTSOURCE,  ATFILESOURCE,  GNUSOURCE,  FORTIFYSOURCE,\nREENTRANT, and THREADSAFE are specific to Linux (glibc).\n",
            "subsections": []
        },
        "NOTES": {
            "content": "<features.h>  is  a  Linux/glibc-specific header file.  Other systems have an analogous file,\nbut typically with a different name.  This header file is  automatically  included  by  other\nheader  files  as  required:  it is not necessary to explicitly include it in order to employ\nfeature test macros.\n\nAccording to which of the above feature test macros are defined, <features.h> internally  de‐\nfines  various  other macros that are checked by other glibc header files.  These macros have\nnames prefixed by two underscores (e.g., USEMISC).  Programs  should  never  define  these\nmacros directly: instead, the appropriate feature test macro(s) from the list above should be\nemployed.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "The program below can be used to explore how the various feature test macros are set  depend‐\ning  on  the  glibc  version  and what feature test macros are explicitly set.  The following\nshell session, on a system with glibc 2.10, shows some examples of what we would see:\n\n$ cc ftm.c\n$ ./a.out\nPOSIXSOURCE defined\nPOSIXCSOURCE defined: 200809L\nBSDSOURCE defined\nSVIDSOURCE defined\nATFILESOURCE defined\n$ cc -DXOPENSOURCE=500 ftm.c\n$ ./a.out\nPOSIXSOURCE defined\nPOSIXCSOURCE defined: 199506L\nXOPENSOURCE defined: 500\n$ cc -DGNUSOURCE ftm.c\n$ ./a.out\nPOSIXSOURCE defined\nPOSIXCSOURCE defined: 200809L\nISOC99SOURCE defined\nXOPENSOURCE defined: 700\nXOPENSOURCEEXTENDED defined\nLARGEFILE64SOURCE defined\nBSDSOURCE defined\nSVIDSOURCE defined\nATFILESOURCE defined\nGNUSOURCE defined\n",
            "subsections": [
                {
                    "name": "Program source",
                    "content": "/* ftm.c */\n\n#include <stdint.h>\n#include <stdio.h>\n#include <unistd.h>\n#include <stdlib.h>\n\nint\nmain(int argc, char *argv[])\n{\n#ifdef POSIXSOURCE\nprintf(\"POSIXSOURCE defined\\n\");\n#endif\n\n#ifdef POSIXCSOURCE\nprintf(\"POSIXCSOURCE defined: %jdL\\n\",\n(intmaxt) POSIXCSOURCE);\n#endif\n\n#ifdef ISOC99SOURCE\nprintf(\"ISOC99SOURCE defined\\n\");\n#endif\n\n#ifdef ISOC11SOURCE\nprintf(\"ISOC11SOURCE defined\\n\");\n#endif\n\n#ifdef XOPENSOURCE\nprintf(\"XOPENSOURCE defined: %d\\n\", XOPENSOURCE);\n#endif\n\n#ifdef XOPENSOURCEEXTENDED\nprintf(\"XOPENSOURCEEXTENDED defined\\n\");\n#endif\n\n#ifdef LARGEFILE64SOURCE\nprintf(\"LARGEFILE64SOURCE defined\\n\");\n#endif\n\n#ifdef FILEOFFSETBITS\nprintf(\"FILEOFFSETBITS defined: %d\\n\", FILEOFFSETBITS);\n#endif\n\n#ifdef BSDSOURCE\nprintf(\"BSDSOURCE defined\\n\");\n#endif\n\n#ifdef SVIDSOURCE\nprintf(\"SVIDSOURCE defined\\n\");\n#endif\n\n#ifdef DEFAULTSOURCE\nprintf(\"DEFAULTSOURCE defined\\n\");\n#endif\n\n#ifdef ATFILESOURCE\nprintf(\"ATFILESOURCE defined\\n\");\n#endif\n\n#ifdef GNUSOURCE\nprintf(\"GNUSOURCE defined\\n\");\n#endif\n\n#ifdef REENTRANT\nprintf(\"REENTRANT defined\\n\");\n#endif\n\n#ifdef THREADSAFE\nprintf(\"THREADSAFE defined\\n\");\n#endif\n\n#ifdef FORTIFYSOURCE\nprintf(\"FORTIFYSOURCE defined\\n\");\n#endif\n\nexit(EXITSUCCESS);\n}\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "libc(7), standards(7), systemdatatypes(7)\n\nThe section \"Feature Test Macros\" under info libc.\n\n/usr/include/features.h\n",
            "subsections": []
        },
        "COLOPHON": {
            "content": "This page is part of release 5.10 of the Linux  man-pages  project.   A  description  of  the\nproject,  information about reporting bugs, and the latest version of this page, can be found\nat https://www.kernel.org/doc/man-pages/.\n\n\n\nLinux                                        2020-11-01                       FEATURETESTMACROS(7)",
            "subsections": []
        }
    },
    "summary": "featuretestmacros - feature test macros",
    "flags": [],
    "examples": [
        "The program below can be used to explore how the various feature test macros are set  depend‐",
        "ing  on  the  glibc  version  and what feature test macros are explicitly set.  The following",
        "shell session, on a system with glibc 2.10, shows some examples of what we would see:",
        "$ cc ftm.c",
        "$ ./a.out",
        "POSIXSOURCE defined",
        "POSIXCSOURCE defined: 200809L",
        "BSDSOURCE defined",
        "SVIDSOURCE defined",
        "ATFILESOURCE defined",
        "$ cc -DXOPENSOURCE=500 ftm.c",
        "$ ./a.out",
        "POSIXSOURCE defined",
        "POSIXCSOURCE defined: 199506L",
        "XOPENSOURCE defined: 500",
        "$ cc -DGNUSOURCE ftm.c",
        "$ ./a.out",
        "POSIXSOURCE defined",
        "POSIXCSOURCE defined: 200809L",
        "ISOC99SOURCE defined",
        "XOPENSOURCE defined: 700",
        "XOPENSOURCEEXTENDED defined",
        "LARGEFILE64SOURCE defined",
        "BSDSOURCE defined",
        "SVIDSOURCE defined",
        "ATFILESOURCE defined",
        "GNUSOURCE defined",
        "/* ftm.c */",
        "#include <stdint.h>",
        "#include <stdio.h>",
        "#include <unistd.h>",
        "#include <stdlib.h>",
        "int",
        "main(int argc, char *argv[])",
        "#ifdef POSIXSOURCE",
        "printf(\"POSIXSOURCE defined\\n\");",
        "#endif",
        "#ifdef POSIXCSOURCE",
        "printf(\"POSIXCSOURCE defined: %jdL\\n\",",
        "(intmaxt) POSIXCSOURCE);",
        "#endif",
        "#ifdef ISOC99SOURCE",
        "printf(\"ISOC99SOURCE defined\\n\");",
        "#endif",
        "#ifdef ISOC11SOURCE",
        "printf(\"ISOC11SOURCE defined\\n\");",
        "#endif",
        "#ifdef XOPENSOURCE",
        "printf(\"XOPENSOURCE defined: %d\\n\", XOPENSOURCE);",
        "#endif",
        "#ifdef XOPENSOURCEEXTENDED",
        "printf(\"XOPENSOURCEEXTENDED defined\\n\");",
        "#endif",
        "#ifdef LARGEFILE64SOURCE",
        "printf(\"LARGEFILE64SOURCE defined\\n\");",
        "#endif",
        "#ifdef FILEOFFSETBITS",
        "printf(\"FILEOFFSETBITS defined: %d\\n\", FILEOFFSETBITS);",
        "#endif",
        "#ifdef BSDSOURCE",
        "printf(\"BSDSOURCE defined\\n\");",
        "#endif",
        "#ifdef SVIDSOURCE",
        "printf(\"SVIDSOURCE defined\\n\");",
        "#endif",
        "#ifdef DEFAULTSOURCE",
        "printf(\"DEFAULTSOURCE defined\\n\");",
        "#endif",
        "#ifdef ATFILESOURCE",
        "printf(\"ATFILESOURCE defined\\n\");",
        "#endif",
        "#ifdef GNUSOURCE",
        "printf(\"GNUSOURCE defined\\n\");",
        "#endif",
        "#ifdef REENTRANT",
        "printf(\"REENTRANT defined\\n\");",
        "#endif",
        "#ifdef THREADSAFE",
        "printf(\"THREADSAFE defined\\n\");",
        "#endif",
        "#ifdef FORTIFYSOURCE",
        "printf(\"FORTIFYSOURCE defined\\n\");",
        "#endif",
        "exit(EXITSUCCESS);"
    ],
    "see_also": [
        {
            "name": "libc",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/libc/7/json"
        },
        {
            "name": "standards",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/standards/7/json"
        },
        {
            "name": "systemdatatypes",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/systemdatatypes/7/json"
        }
    ]
}