Ternary operator without second operand
<p>This is a two legged question: one for C and one for C++.</p>

<p>What the C and C++ standards have to say about the following use of the ternary (<code>?:</code>) operator:</p>

<pre><code>const char* opt = /* possible NULL pointer */;
const char* str = opt ?: "";
</code></pre>

<p>When did it became legal? Is it a compiler extension? What are the requirements on the first operand (implicitly convertible to <code>bool</code>/<code>int</code>)?</p>