cpp: System-specific Predefined Macros

1 
1 3.7.3 System-specific Predefined Macros
1 ---------------------------------------
1 
1 The C preprocessor normally predefines several macros that indicate what
1 type of system and machine is in use.  They are obviously different on
1 each target supported by GCC.  This manual, being for all systems and
1 machines, cannot tell you what their names are, but you can use 'cpp
1 -dM' to see them all.  ⇒Invocation.  All system-specific
1 predefined macros expand to a constant value, so you can test them with
1 either '#ifdef' or '#if'.
1 
1    The C standard requires that all system-specific macros be part of
1 the "reserved namespace".  All names which begin with two underscores,
1 or an underscore and a capital letter, are reserved for the compiler and
1 library to use as they wish.  However, historically system-specific
1 macros have had names with no special prefix; for instance, it is common
1 to find 'unix' defined on Unix systems.  For all such macros, GCC
1 provides a parallel macro with two underscores added at the beginning
1 and the end.  If 'unix' is defined, '__unix__' will be defined too.
1 There will never be more than two underscores; the parallel of '_mips'
1 is '__mips__'.
1 
1    When the '-ansi' option, or any '-std' option that requests strict
1 conformance, is given to the compiler, all the system-specific
1 predefined macros outside the reserved namespace are suppressed.  The
1 parallel macros, inside the reserved namespace, remain defined.
1 
1    We are slowly phasing out all predefined macros which are outside the
1 reserved namespace.  You should never use them in new programs, and we
1 encourage you to correct older code to use the parallel macros whenever
1 you find it.  We don't recommend you use the system-specific macros that
1 are in the reserved namespace, either.  It is better in the long run to
1 check specifically for features you need, using a tool such as
1 'autoconf'.
1