29.12.2014 Views

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Language Extensions<br />

Example<br />

class B;<br />

class A<br />

{<br />

friend B; // is the same as "friend class B"<br />

};<br />

See also<br />

• --[no_]strict on page 2-84.<br />

3.5.4 Read/write constants<br />

A linkage specification for external constants indicates that a constant can be<br />

dynamically initialized or have mutable members.<br />

Note<br />

The use of "C++:read/write" linkage is only necessary for code compiled with --apcs<br />

/rwpi. If you recompile existing code with this option, you must change the linkage<br />

specification for external constants that are dynamically initialized or have mutable<br />

members.<br />

Compiling C++ with the --apcs /rwpi option deviates from the ISO C++ Standard. The<br />

declarations in Example 3-1 assume that x is in a read-only segment.<br />

Example 3-1 External access<br />

extern const T x;<br />

extern "C++" const T x;<br />

extern "C" const T x;<br />

Dynamic initialization of x including user-defined constructors is not possible for<br />

constants and T cannot contain mutable members. The new linkage specification in<br />

Example 3-2 on page 3-17 declares that x is in a read/write segment even if it is<br />

initialized with a constant. Dynamic initialization of x is permitted and T can contain<br />

mutable members. The definitions of x, y, and z in another file must have the same<br />

linkage specifications.<br />

3-16 Copyright © 2007, 2010 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0348A<br />

Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!