04.01.2015 Views

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

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 />

Errors<br />

The compiler generates a warning if it detects arithmetic on void pointers or function<br />

pointers.<br />

Example<br />

int ptr_arith_0(void)<br />

{<br />

void * pointer;<br />

return sizeof *pointer;<br />

}<br />

int ptr_arith_1(void)<br />

{<br />

static int diff;<br />

diff = ptr_arith_0 - ptr_arith_1;<br />

return sizeof ptr_arith_0;<br />

}<br />

3.7.14 Statement expressions<br />

Statement expressions enable you to place whole sections of code, including<br />

declarations, within braces ({ }) .<br />

The result of a statement expression is the final item in the statement list.<br />

Restrictions<br />

Branches into a statement expression are not allowed.<br />

In C++ mode, branches out are also not allowed. Variable-length arrays, destructible<br />

entities, try, catch, local non-POD class definitions, and dynamically initialized local<br />

static variables are not allowed inside a statement expression.<br />

Example<br />

int bar(int b, int foo)<br />

{<br />

if (({<br />

int y = foo;<br />

int z;<br />

if (y > 0) z = y;<br />

else z = -y;<br />

z>b;<br />

}))<br />

<strong>ARM</strong> DUI 0348C Copyright © 2007-2010 <strong>ARM</strong>. All rights reserved. 3-31<br />

ID101213<br />

Non-Confidential,

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

Saved successfully!

Ooh no, something went wrong!