| |||
| Home > Language Extensions > GNU language extensions > 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.