Language Standards Supported by GCC
For each language compiled by GCC for which there is a standard, GCC attempts to follow one or
more versions of that standard, possibly with some exceptions, and possibly with some extensions.
GCC supports three versions of the C standard, although support for the most recent version is not yet
complete.
The original ANSI C standard (X3.159-1989) was ratified in 1989 and published in 1990. This stan-
dard was ratified as an ISO standard (ISO/IEC 9899:1990) later in 1990. There were no technical
differences between these publications, although the sections of the ANSI standard were renumbered
and became clauses in the ISO standard. This standard, in both its forms, is commonly known as
C89, or occasionally as C90, from the dates of ratification. The ANSI standard, but not the ISO stan-
dard, also came with a Rationale document. To select this standard in GCC, use one of the options
,
-ansi
-std=c89
you should also specify
than warnings). Refer to Section 4.4 Options Controlling C Dialect.
Errors in the 1990 ISO C standard were corrected in two Technical Corrigenda published in 1994 and
1996. GCC does not support the uncorrected version.
An amendment to the 1990 standard was published in 1995. This amendment added digraphs and
__STDC_VERSION__
monly known as AMD1; the amended standard is sometimes known as C94 or C95. To select this
standard in GCC, use the option
to receive all required diagnostics).
-pedantic
A new edition of the ISO C standard was published in 1999 as ISO/IEC 9899:1999, and
is commonly known as C99. GCC has incomplete support for this standard version; see
http://gcc.gnu.org/c99status.html for details. To select this standard, use
-std=iso9899:1999
C9X.)
Errors in the 1999 ISO C standard were corrected in a Technical Corrigendum published in 2001.
GCC does not support the uncorrected version.
By default, GCC provides some extensions to the C language that on rare occasions conflict with the
C standard. Refer to Chapter 6 Extensions to the C Language Family. Use of the
above will disable these extensions where they conflict with the C standard version selected. You may
also select an extended version of the C language explicitly with
extensions) or
-std=gnu99
options are given, is
C99 support is complete. Some features that are part of the C99 standard are accepted as extensions
in C89 mode.
The ISO C standard defines (in clause 4) two classes of conforming implementation. A conforming
hosted implementation supports the whole standard including all the library facilities; a conforming
freestanding implementation is only required to provide certain library facilities: those in
,
float.h
limits.h
; and in C99, also those in
iso646.h
types, added in C99, are not required for freestanding implementations. The standard also defines
two environments for programs, a freestanding environment, required of all implementations and
which may not have library facilities beyond those required of freestanding implementations,
where the handling of program startup and termination are implementation-defined, and a hosted
environment, which is not required, in which all the library facilities are provided and startup is
through a function
int main (void)
or
-std=iso9899:1990
(or
-pedantic
to the language, but otherwise concerned the library. This amendment is com-
-std=iso9899:199409
. (While in development, drafts of this standard version were referred to as
(for C99 with GNU extensions). The default, if no C language dialect
; this will change to
-std=gnu89
,
stdarg.h
; to obtain all the diagnostics required by the standard,
-pedantic-errors
-std=gnu99
, and
stddef.h
and
stdbool.h
or
int main (int, char *[])
Chapter 3.
if you want them to be errors rather
(with, as for other standard versions,
-std
(for C89 with GNU
-std=gnu89
in some future release when the
; since AMD1, also those in
. In addition, complex
stdint.h
. An OS kernel would be
or
-std=c99
options listed
Need help?
Do you have a question about the ENTERPRISE LINUX 3 - USING GCC and is the answer not in the manual?
Questions and answers