3.7.8. Conditionals

The middle operand in a conditional statement can be omitted, if the result is to be the same as the test, for example:

i ? i : j;

This is most useful if the test modifies the value in some way, for example:

i++ ? : j;

where i++ comes from a macro. If you write code in this way, then i++ is evaluated only once.

If the original value of i is nonzero, the result is the original value of i. Regardless of this, i is incremented once.

Copyright © 2007, 2010 ARM Limited. All rights reserved.ARM DUI 0348A
Non-Confidential