2.3.3. Setting the source language

This section describes options that determine the source language variant accepted by the compiler (see also Controlling code generation ).

The following options specify how strictly the compiler enforces the standards and conventions of that language. By default, the C compilers compile ANSI-C, and the C++ compilers compile as much as they can of ISO/IEC C++.

-ansi

This option compiles ANSI standard C. This is the default for armcc and tcc. The default mode is a fairly strict ANSI compiler, but without some of the inconvenient features of the ANSI standard. There are also some minor extensions allowed (for example // in comments and $ in identifiers).

-ansic

This option compiles ANSI standard C. This option is synonymous with the -ansi option.

-cpp

This option compiles ISO/IEC C++. This option is the default with the C++ compilers and not available with the C compilers.

-embeddedcplusplus

This option compiles standard Embedded C++ (EC++). This option is not available with the C compilers.

-strict

This option enforces more stringent conformance to the ANSI C standard and the ISO/IEC C++ standard. For example, the following code:


static struct T {int i; };

gives an error when compiled with -cpp -strict, but only a warning with -cpp. Because no object is declared, static is spurious. In the C++ standard, the code shown is therefore illegal.

You can combine language options:

armcc -ansi

Compiles ANSI standard C. This is the default.

armcc -strict

Compiles strict ANSI standard C.

armcpp

Compiles standard C++.

armcpp -ansi

Compiles normal ANSI standard C (C mode of C++).

armcpp -ansi -strict

Compiles strict ANSI standard C (C mode of C++).

armcpp -strict

Compiles strict C++.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D
Non-Confidential