Previous Page
Next Page

18.4. C Dialects

When writing a C program, one of your first tasks is to decide which of the various definitions of the C language applies to your program. GCC's default dialect is "GNU C," which is largely the ISO/IEC 9899:1990 standard, with its published corrigenda, and with a number of language extensions. These extensions include many features that have since been standardized in C99such as complex floating-point types and long long integersas well as other features that have not been adopted, such as complex integer types and zero-length arrays. The full list of extensions is provided in the GCC documentation.

To turn off all the GNU C extensions, use the command-line option -ansi. This book describes C as defined in ISO/IEC 9899:1999, or "C99." GCC adheres (not yet completely, but nearly so) to C99 if you use the command-line option -std=c99, and we have done so in testing the examples in this book.

GCC's language standardization options are:

-std=iso9899:1990, -std=c89, -ansi

These three options all mean the same thing: conform to ISO/IEC 9899:1990, including Technical Corrigenda of 1994 and 1996. They do not mean that no extensions are accepted: only those GNU extensions that conflict with the ISO standard are disabled, such as the typeof operator.


Conform to "AMD1," the 1995 internationalization amendment to ISO/IEC 9899:1990.

-std=iso9899:1999, -std=c99

Conform to ISO/IEC 9899:1999, with the Technical Corrigendum of 2001. Note that support for all provisions of C99 is not yet complete. See for the current development status.


Support ISO/IEC 9899:1990 and the GNU extensions. This dialect is GCC's default.


Support ISO/IEC 9899:1999 and the GNU extensions. This dialect is expected to become the default dialect of future GCC versions once C99 support has been completed.

With any of these options, you must also add the option -pedantic if you want GCC to issue all the warnings that are required by the given standard version, and to reject all extensions that are prohibited by the standard. The option -pedantic-errors causes compiling to fail when such warnings occur.

Earlier versions of GCC also offered a -traditional option, which was intended to provide support for pre-ANSI or "K&R-style" C. Currently GCC supports this option only in the preprocessing stage, and accepts it only in conjunction with the -E option, which directs GCC to perform preprocessing and then exit.

Furthermore, a number of GCC options allow you to enable or disable individual aspects of different standards and extensions. For example, the -trigraphs option enables trigraphs (see "Digraphs and Trigraphs" in Chapter 1) even if you have not used the -ansi option. For the full list of available dialect options, see the GCC manual.

Previous Page
Next Page