diff options
Diffstat (limited to 'devdocs/gcc~13/conditionals.html')
| -rw-r--r-- | devdocs/gcc~13/conditionals.html | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/devdocs/gcc~13/conditionals.html b/devdocs/gcc~13/conditionals.html new file mode 100644 index 00000000..9dd49a0d --- /dev/null +++ b/devdocs/gcc~13/conditionals.html @@ -0,0 +1,8 @@ +<div class="section-level-extent" id="Conditionals"> <div class="nav-panel"> <p> Next: <a href="_005f_005fint128" accesskey="n" rel="next">128-bit Integers</a>, Previous: <a href="typeof" accesskey="p" rel="prev">Referring to a Type with <code class="code">typeof</code></a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Conditionals-with-Omitted-Operands"><span>6.8 Conditionals with Omitted Operands<a class="copiable-link" href="#Conditionals-with-Omitted-Operands"> ΒΆ</a></span></h1> <p>The middle operand in a conditional expression may be omitted. Then if the first operand is nonzero, its value is the value of the conditional expression. </p> <p>Therefore, the expression </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">x ? : y</pre> +</div> <p>has the value of <code class="code">x</code> if that is nonzero; otherwise, the value of <code class="code">y</code>. </p> <p>This example is perfectly equivalent to </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">x ? x : y</pre> +</div> <p>In this simple case, the ability to omit the middle operand is not especially useful. When it becomes useful is when the first operand does, or may (if it is a macro argument), contain a side effect. Then repeating the operand in the middle would perform the side effect twice. Omitting the middle operand uses the value already computed without the undesirable effects of recomputing it. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Conditionals.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Conditionals.html</a> + </p> +</div> |
