C Standards Support in GCC
C2y can be explicitly selected with the -std=c2ycommand-line flag, or -std=gnu2y to enable GNU extensions as well.
C23 mode is the default since GCC 15; it can be explicitly selected with the-std=c23 command-line flag, or -std=gnu23to enable GNU extensions as well.
Feature
Proposal
Version
Notes
New keywords alignas, alignof,bool, false, static_assert,thread_local, true
_Static_assert with no message
support for _Static_assert with two arguments was added in C11 and GCC 4.6
Removed support for function definitions with identifier lists
removal of old-style function definitions
Removal of unprototyped functions
function declarations whose parameter list is empty are treated the same as a parameter list which only contain a single void
strftime supports %OB and %Ob formats
10 (format checking)
harmonization with ISO/IEC 9945; glibc support for these formats was added in glibc 2.27
IEEE 754 decimal floating-point types (Optional)
4.3 (IA-32, x86-64, PowerPC, S/390)
13 (aarch64)
DEC*_TRUE_MIN macros added inGCC 10
IEEE 754 interchange and extended types (Optional)
7 (binary types)
15 (Annex H suffixes for decimal types and_Decimal64x)
Add *_NORM_MAX constants to <float.h>
NaN and Inf macros in <float.h>
corresponding built-in functions __builtin_nansdN added
*_IS_IEC_60559 macros in <float.h>
__STDC_WANT_IEC_60559_EXT__ supported by <float.h>
__STDC_VERSION_*_H__ header version macros
Labels before declarations and end of blocks
[[]] attribute syntax
__has_c_attribute preprocessor operator
[[deprecated]]
[[fallthrough]]
[[maybe_unused]]
support other than on labels added in GCC 10
[[nodiscard]]
[[noreturn]]
[[unsequenced]] and [[reproducible]]
u8 character constants
for char8_t seeN2653
Type change of u8 string literals
Introduce storage-class specifiers for compound literals
The constexpr specifier for object definitions
Support for empty initializer braces
some cases were already supported, but not scalars and VLAs
typeof, typeof_unqual
typeof was previously supported as an extension
Improved tag compatibility
Bit-precise integer types (_BitInt)
14 (IA-32, x86-64 and AArch64 (little-endian) only)
Improved rules for handling enumerations without underlying types
3.0
allows enums wider than int; adjusted inGCC 13
Enhanced Enumerations (fixed underlying types)
#embed
nullptr constant
__VA_OPT__
Parameter names may be omitted in function definitions
Relax requirements for variadic parameter lists
Identifier Syntax using Unicode Standard Annex 31
__has_include
Type inference for object definitions (auto)
#elifdef, #elifndef preprocessor directives
#warning
2.0
Binary integer literals
Formatting for input/output of binary integer numbers
mainly a glibc feature; GCC format checking support present
Digit separators
unreachable macro in <stddef.h>
BOOL_MAX and BOOL_WIDTH macros in<limits.h>
ATOMIC_VAR_INIT removed
Removal of trigraphs
can still be enabled using -trigraphs
<stdckdint.h> header for checked integer arithmetic
C17 can be explicitly selected with the -std=c17command-line flag, or -std=gnu17 to enable GNU extensions as well.
This was the default mode from GCC 8 to GCC 14 (including).
C11 can be explicitly selected with the -std=c11command-line flag, or -std=gnu11 to enable GNU extensions as well.
Feature
Proposal
Version
Notes
Atomics (_Atomic, <stdatomic.h>)
Thread-local storage (_Thread_local)
Additional floating-point characteristic macros (<float.h>)
Alignment support (_Alignas, _Alignof,max_align_t, <stdalign.h>)
Unicode characters and strings (<uchar.h>)
library part: glibc 2.16; originally specified in ISO/IEC TR 19769:2004; previously supported only with options such as-std=gnu11
Type-generic expressions (_Generic)
Static assertions (_Static_assert)
static_assert in <assert.h>: glibc 2.16
Anonymous structures and unions
the basics were first added in GCC 3.0
Typedef redefinition
Nonreturning functions (_Noreturn and<stdnoreturn.h>)
Macros to create complex numbers (<complex.h>)
library part: glibc 2.16
Support for opening files for exclusive access
N/A
Library issue (glibc 2.x)
Remove the gets function (<stdio.h>)
N/A
Library issue (glibc 2.16)
aligned_alloc, at_quick_exit, andquick_exit functions (<stdlib.h>)
N/A
Library issue (glibc 2.16)
struct timespec, timespec_get function in <time.h>
N/A
Library issue (glibc 2.16)
Threading, <threads.h> (Optional)
N/A
Library issue (glibc 2.28)
Support for bounds-checking interfaces (Annex K, Optional)
N/A
Library issue (not implemented)
Support for analyzability (Annex L, Optional)
N/A
C99 is substantially completely supported as of GCC 4.5 (with -std=c99 -pedantic-errors used;-fextended-identifiers also needed to enable extended identifiers before GCC 5), modulo bugs and floating-point issues (mainly but not entirely relating to optional C99 features from Annexes F and G). The following table gives more details of the C99 support in different GCC versions.
This table is based on the list in the foreword to N1256(ISO/IEC 9899:1999 (E), consolidated with ISO/IEC 9899:1999/Cor.1:2001 (E), ISO/IEC 9899:1999/Cor.2:2004 (E) and ISO/IEC 9899:1999/Cor.3:2007 (E)).
The "Version" column indicates the first GCC version in which support for the relevant feature was substantially present; some bugs or corner cases may have been fixed in later versions; this column is "N/A" if nothing is needed from the compiler for the feature to be substantially supported (for example, if the feature refers to addition of new library functions rather than language features), even if additional compiler features could be useful in conjunction with it. It is assumed that GCC is used with -std=c99 -pedantic-errors (for versions 3.0 and later), as well as -fextended-identifiers in the case of that feature before GCC 5. Where library cooperation is required, it is assumed that a recent version of the GNU C Library is in use, and support with other C libraries may be less good. Where the version listed is before GCC 3.0, it should not be assumed that all corner cases follow C99 before GCC 3.0, even if there is no specific note regarding corner cases.
See below the table for further notes on some issues.
Feature
Version
Notes
restricted character set support via digraphs and<iso646.h> (originally specified in AMD1)
GCC 2.7
wide character library support in<wchar.h> and <wctype.h> (originally specified in AMD1)
N/A
Library feature, no compiler support required. GCC doesn't have wprintf, wscanf andwcsftime format checking support.
more precise aliasing rules via effective type
N/A
Optimization, no compiler support required. GCC has optimized based on aliasing rules since GCC 2.95.
restricted pointers
GCC 2.95
variable length arrays
GCC 0.9
Various corner cases fixed in GCC 4.5.
flexible array members
GCC 3.0
static and type qualifiers in parameter array declarators
GCC 3.1
complex (and imaginary) support in <complex.h>
GCC 3.0
New functions are a library issue not requiring much compiler support (some built-in functions present). Complex numbers are supported with __complex__ since GCC 2.5, and with C99 _Complex since GCC 3.0. Complex multiplication and division support C99 special cases since GCC 4.0. Various corner cases were fixed in GCC 4.5. GCC does not support the Annex G imaginary types, but this support is optional, and complex multiplication and division have excess overflows at runtime (although not beyond those permitted by C99).
type-generic math macros in <tgmath.h>
N/A
Library feature; GCC built-in functions may be used in implementing it.
the long long int type and library functions
≤ GCC 1.27
New functions are a library issue not requiring much compiler support (some built-in functions present).
increased minimum translation limits
GCC 0.9
GNU policy has always avoided arbitrary limits.
additional floating-point characteristics in <float.h>
GCC 3.0
remove implicit int
GCC 3.0
reliable integer division
GCC 0.9
universal character names (\u and \U)
GCC 3.1
extended identifiers
GCC 4.1
Some corner cases were fixed in GCC 5;-fextended-identifiers was needed to enable this feature before that version.
hexadecimal floating-point constants and%a and %A printf/scanf conversion specifiers
GCC 2.8
Conversion specifiers are a library issue (format checking support present).
compound literals
GCC 3.1
The syntax was supported by GCC by version 1.21, but with significant differences from C99 requirements until GCC 3.1.
designated initializers
GCC 3.0
The syntax was supported since GCC 2.5, but with significant differences from C99 requirements until GCC 3.0.
// comments
GCC 2.7
extended integer types and library functions in <inttypes.h> and <stdint.h>
N/A
All of this can be provided by the library rather than the compiler (some built-in function support also present). <stdint.h> is provided by GCC (as of version 4.5), or fixed where the system headers provide a nonconforming version, on some but not yet all systems. On systems where types in this header have been defined as char, GCC retains this definition although it is not permitted by C99.
remove implicit function declaration
GCC 3.0
preprocessor arithmetic done in intmaxt/uintmaxt
GCC 3.3
mixed declarations and code
GCC 3.0
new block scopes for selection and iteration statements
GCC 3.0
integer constant type rules
GCC 3.3
integer promotion rules
GCC 4.0
macros with a variable number of arguments
GCC 2.95
the vscanf family of functions in <stdio.h> and <wchar.h>
N/A
Library feature, no compiler support required (format checking support present).
additional math library functions in <math.h>
N/A
Library feature, no compiler support required (various built-in functions present).
treatment of error conditions by math library functions (matherrhandling)
N/A
Library feature, no compiler support required.
floating-point environment access in <fenv.h>
N/A
Library feature, no compiler support required.
IEC 60559 (also known as IEC 559 or IEEE arithmetic) support
Optional feature, not properly supported in GCC.
trailing comma allowed in enum declaration
GCC 0.9
%lf conversion specifier allowed in printf
N/A
Library feature, no compiler support required (format checking support present).
inline functions
GCC 4.3
Inline function support present since at least GCC 1.21, but with major differences from C99 semantics until 4.3.
the snprintf family of functions in <stdio.h>
N/A
Library feature, no compiler support required (format checking support present).
boolean type in <stdbool.h>
GCC 3.0
GCC 2.95 had <stdbool.h>, but based on an early draft with major differences from C99 semantics.
idempotent type qualifiers
GCC 3.0
Always has been allowed, with a warning as required by C90 depending on GCC version.
empty macro arguments
GCC 0.9
Undefined behavior in C90, but GCC not known ever to have handled them contrary to C99.
new structure type compatibility rules (tag compatibility)
GCC 0.9
This relates to compatibility between translation units.
additional predefined macro names
GCC 3.0
Support for the compiler to implicitly preinclude a file stdc-predef.h provided by the C library, and so predefine macros relating to library properties for the whole translation unit, is new in GCC 4.8.
Pragma preprocessing operator
GCC 3.0
standard pragmas
Not implemented. Associated command-line options to control the state of the pragmas for the whole translation unit are available.
_func_ predefined identifier
GCC 2.95
vacopy macro
GCC 3.0
additional strftime conversion specifiers
N/A
Library feature, no compiler support required (format checking support present).
LIA compatibility annex
N/A
This annex describes how C relates to another standard, and does not impose any requirements on C implementations.
deprecate ungetc at the beginning of a binary file
N/A
Library feature, no compiler support required.
remove deprecation of aliased array parameters
GCC 0.9
GCC has never done anything regarding this deprecation.
conversion of array to pointer not limited to lvalues
GCC 3.1
Some support since GCC 2.0, but with major differences from C99 requirements before GCC 3.1.
relaxed constraints on aggregate and union initialization
≤ GCC 1.21
relaxed restrictions on portable header names
GCC 0.9
GCC has never had such restrictions itself.
return without expression not permitted in function that returns a value (and vice versa)
GCC 3.0