Download RealView Compilation Tools Compiler Reference Guide
Transcript
Language Extensions
Example 3-2 Linkage specification
extern const int z;
/* in read-only segment, cannot
/* be dynamically initialized
extern "C++:read/write" const int y;
/* in read/write segment */
/* can be dynamically initialized */
extern "C++:read/write"
{
const int i=5;
extern const T x=6;
struct S
{
static const T T x;
};
*/
*/
/* placed in read-only segment, */
/* not extern because implicitly static */
/* placed in read/write segment */
/* placed in read/write segment */
}
Constant objects must not be redeclared with another linkage. The code in Example 3-3
produces a compile error.
Example 3-3 Compiler error
extern "C++" const T x;
extern "C++:read/write" const T x; /* error */
Note
Because C does not have the linkage specifications, you cannot use a const object
declared in C++ as extern "C++:read/write" from C.
See also
•
3.5.5
--apcs=qualifer...qualifier on page 2-4.
Scalar type constants
Constants of scalar type can be defined within classes. This is an old form. The modern
form uses an initialized static data member.
ARM DUI 0348A
Copyright © 2007, 2010 ARM Limited. All rights reserved.
Non-Confidential
3-17