8.4.2. C++ specific information

The following applies specifically to C++.

C++ calling conventions

ARM C++ uses the same calling conventions as ARM C with the following exceptions:

  • When an object of type struct or class is passed to a function and the type has an explicit copy constructor, the object is passed by reference and the called function makes a copy.

  • Non-static member functions are called with the implicit this parameter as the first argument, or as the second argument if the called function returns a non int-like struct.

C++ data types

ARM C++ uses the same data types as ARM C with the following exceptions and additions:

  • C++ objects of type struct or class have the same layout as would be expected from the ARM C compiler if they have no base classes or virtual functions. If such a struct has neither a user-defined copy assignment operator, or a user-defined destructor, it is a plain old data (POD) structure.

  • References are represented as pointers.

  • Pointers to data members and pointers to member functions occupy four bytes. They have the same null pointer representation as normal pointers.

  • No distinction is made between pointers to C functions and pointers to C++ (non-member) functions.

Symbol name mangling

ARM C++ mangles external names of functions and static data members in a manner similar to that described in section 7.2c of Ellis, M.A. and Stroustrup, B., The Annotated C++ Reference Manual (1990). The linker, decaof, and decaxf unmangle symbols.

C names must be declared as extern "C" in C++ programs. This is done already for the ARM ANSI C headers. Refer to Using C header files from C++ for more information.

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0040D
Non-Confidential