| |||
Home > Introduction > Language extensions and language compliance > Language compliance |
The compiler has several modes in which compliance to a source language is either enforced or relaxed:
In strict mode the compiler enforces compliance with the language standard relevant to the source language. For example, the use of //-style comments results in an error when compiling strict C90.
To compile in strict mode, use the command-line option --strict
.
In GNU mode all the GNU compiler extensions to the relevant source language are available. For example, in GNU mode:
case ranges in switch statements are available when the source language is any of C90, C99 or non-strict C++
C99-style designated initializers are available when the source language is either C90 or non strict C++.
To compile in GNU mode, use the compiler option --gnu
.
Some GNU extensions are also available when you are in a non-strict mode.
The following examples illustrate combining source language modes with language compliance modes:
Compiling a .cpp
file
with the command-line option
--strict
compiles
Standard C++
Compiling a C source file with the command-line
option --gnu
compiles GNU mode C90
Compiling a .c
file with the
command-line options --strict
and --gnu
is
an error.
File naming conventions in the Compiler User Guide.