| |||
| Home > The ARM Compilers > About the ARM compilers > Source language modes | |||
The ARM compilers have a number of distinct source language modes that can be used to compile several varieties of C and C++ source code. The source language modes supported are:
In ANSI C mode, the ARM compilers are tested against release 7.00 of the Plum Hall C Validation Suite (CVS). This suite has been adopted by the British Standards Institute for C compiler validation in Europe.
The compiler behavior differs from the behavior described in the language conformance sections of the CVS in the following ways:
An empty
initializer for an aggregate of complete type generates a warning
unless -fussy is specified. For example:
int x[3] = {};
The expression sin(DBL_MAX) causes
a floating-point trap if -apcs /hardfp is specified.
There is no support for the wctype.h and wchar.h headers.
In PCC mode, the compilers accept the dialect of C that conforms to the conventions of Berkeley UNIX (BSD 4.2) Portable C compiler C (PCC). This dialect is based on the original Kernighan and Ritchie definition of C, and is the one used on Berkeley UNIX systems.
This mode applies only to the ARM C++ compilers. In C++ mode, the ARM C++ compilers compile C++ as defined by the ISO/IEC Draft Standard. The compilers are tested against Suite++, The Plum Hall Validation Suite for C++, version 4.00. This is the default language mode for the ARM C++ compilers.
This mode applies only to the ARM C++ compilers. In Cfront mode, the ARM C++ compilers are more likely to accept programs that Cfront accepts. For example, in Cfront mode the scope of identifiers declared in for statements extends to the end of the statement or block containing the for statement.
The following differences change the way C++ programs that conform to the C++ Draft Standard behave:
In
Cfront mode D::D in the following example is
a copy constructor and D::operator= is a copy
assignment:
struct B { };
struct D { D(const B&); operator=(const B&); };
In non-Cfront mode, the compiler generates an implicit copy constructor
and copy assignment. A warning is generated. In C++ mode, only 'const
D&' or 'D&' will work.
Implicit conversions to void**, void***, and so on, are allowed. For example:
int* p; void **pp = &p;
This is not normally allowed in C or C++. No warning is given.
The scope of variables declared in for statements extends to the end of the enclosing scope. For example:
for (int i = 0; i < 10; ++i) g(i); int j = i; // accepted only in Cfront mode
No warning is given.
The macro __CFRONT_LIKE is predefined
to 1.
The following differences allow programs that do not conform to the Draft Standard to compile:
Typedefs are allowed in some places where only true class names are permitted by the Draft Standard. For example:
struct T { T(); ~T(); };
typedef T X;
X::X() { } // not legal
void f(T* p) { p->X::~X(); } // not legal
No warning is given.
The following constructs generate warnings instead of errors:
jumps past initializations of objects with no constructor
delete [e] p
enum {,k}
enum {k2,}
class T { friend X; }; // should be friend
class X
For more information on how to use compiler options to set the source mode for the compiler, refer to Setting the source language.