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.

C and C++ Implementation Details<br />

5.2.7 C++ exception handling<br />

C++ exception handling is fully supported in RVCT. However, the compiler does not<br />

support this by default. You must enable C++ exception handling with the --exceptions<br />

option. See --[no_]exceptions on page 2-35 for more information.<br />

Note<br />

The Rogue Wave Standard C++ Library is provided with C++ exceptions enabled.<br />

You can exercise limited control over exception table generation.<br />

Function unwinding at runtime<br />

By default, functions compiled with --exceptions can be unwound at runtime. See<br />

--[no_]exceptions on page 2-35 for more information. Function unwinding includes<br />

destroying C++ automatic variables, and restoring register values saved in the stack<br />

frame. Function unwinding is implemented by emitting an exception table describing<br />

the operations to be performed.<br />

You can enable or disable unwinding for specific functions with the pragmas #pragma<br />

exceptions_unwind and #pragma no_exceptions_unwind, see Pragmas on page 4-49 for<br />

more information. The --exceptions_unwind option sets the initial value of this pragma.<br />

Disabling function unwinding for a function has the following effects:<br />

• Exceptions cannot be thrown through that function at runtime, and no stack<br />

unwinding occurs for that throw. If the throwing language is C++, then<br />

std::terminate is called.<br />

• A very compact exception table representation can be used to describe the<br />

function, which assists smart linkers with table optimization.<br />

• Function inlining is restricted, because the caller and callee must interact<br />

correctly.<br />

Therefore, #pragma no_exceptions_unwind can be used to forcibly prevent unwinding in<br />

a way that requires no additional source decoration.<br />

By contrast, in C++ an empty function exception specification permits unwinding as far<br />

as the protected function, then calls std::unexpected() in accordance with the ISO C++<br />

Standard.<br />

5-18 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!