The standard predefined macros are available with the same meanings
regardless of the machine or operating system on which you are using GNU C.
Their names all start and end with double underscores. Those preceding
__GNUC__
in this table are standardized by ANSI C; the rest are
GNU C extensions.
__FILE__
#include
' or as the input file name argument.
__LINE__
This and `__FILE__
' are useful in generating an error message to
report an inconsistency detected by the program; the message can state
the source line at which the inconsistency was detected. For example,
fprintf (stderr, "Internal error: " "negative string length " "%d at %s, line %d.", length, __FILE__, __LINE__);
A `#include
' directive changes the expansions of `__FILE__
'
and `__LINE__
' to correspond to the included file. At the end of
that file, when processing resumes on the input file that contained
the `#include
' directive, the expansions of `__FILE__
' and
`__LINE__
' revert to the values they had before the
`#include
' (but `__LINE__
' is then incremented by one as
processing moves to the line after the `#include
').
The expansions of both `__FILE__
' and `__LINE__
' are altered
if a `#line
' directive is used. See Combining Sources.
__DATE__
"Feb 1 1996"
'.
__TIME__
"23:59:01"
'.
__STDC__
On some hosts, system include files use a different convention, where
`__STDC__
' is normally 0, but is 1 if the user specifies strict
conformance to the C Standard. The preprocessor follows the host convention
when processing system include files, but when processing user files it follows
the usual GNU C convention.
This macro is not defined if the `-traditional
' option is used.
__STDC_VERSION__
yyyymmL
'
where yyyy and mm are the year and month of the Standard version.
This signifies which version of the C Standard the preprocessor conforms to.
Like `__STDC__
', whether this version number is accurate
for the entire implementation depends on what C compiler
will operate on the output from the preprocessor.
This macro is not defined if the `-traditional
' option is used.
__GNUC__
__GNUC__
' is undefined. The value
identifies the major version number of GNU CC (`1
' for GNU CC
version 1, which is now obsolete, and `2
' for version 2).
__GNUC_MINOR__
__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6)
).
The last number, `3
' in the
example above, denotes the bugfix level of the compiler; no macro
contains this value.
__GNUG__
__GNUG__
' to distinguish between GNU C and GNU
C++.
__cplusplus
__cplusplus
'
to test whether a header is compiled by a C compiler or a C++ compiler.
__STRICT_ANSI__
-ansi
' switch was
specified when GNU C was invoked. Its definition is the null string.
This macro exists primarily to direct certain GNU header files not to
define certain traditional Unix constructs which are incompatible with
ANSI C.
__BASE_FILE__
__INCLUDE_LEVEL__
#include
' directive and decremented at every
end of file. For input files specified by command line arguments,
the nesting level is zero.
__VERSION__
"2.6.0"
'.
__OPTIMIZE__
__CHAR_UNSIGNED__
char
is
unsigned on the target machine. It exists to cause the standard header
file `limits.h
' to work correctly. You should not refer to this
macro yourself; instead, refer to the standard macros defined in
`limits.h
'. The preprocessor uses this macro to determine whether
or not to sign-extend large character constants written in octal; see
#if Directive.
__REGISTER_PREFIX__
m68k-aout
' environment it expands to the null
string, but in the `m68k-coff
' environment it expands to the string
`%
'.
__USER_LABEL_PREFIX__
__REGISTER_PREFIX__
, but describes the prefix applied
to user generated labels in assembler code. For example, in the
`m68k-aout
' environment it expands to the string `_
', but in
the `m68k-coff
' environment it expands to the null string. This
does not work with the `-mno-underscores
' option that the i386
OSF/rose and m88k targets provide nor with the `-mcall*
' options of
the rs6000 System V Release 4 target.
Packaging copyright © 1988-2000 OAR Corporation
Context copyright by each document's author. See Free Software Foundation for information.