diff options
Diffstat (limited to 'devdocs/c/language%2Ftypeof.html')
| -rw-r--r-- | devdocs/c/language%2Ftypeof.html | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/devdocs/c/language%2Ftypeof.html b/devdocs/c/language%2Ftypeof.html new file mode 100644 index 00000000..b9f1c4e0 --- /dev/null +++ b/devdocs/c/language%2Ftypeof.html @@ -0,0 +1,21 @@ + <h1 id="firstHeading" class="firstHeading">typeof operators <span class="t-mark-rev t-since-c23">(since C23)</span> +</h1> <p>Determines the type of an object.</p> +<h3 id="Syntax"> Syntax</h3> <table class="t-sdsc-begin"> <tr class="t-sdsc"> <td> <code>typeof(</code> <span class="t-spar">type</span> <code>)</code> </td> <td> (1) </td> <td class="t-sdsc-nopad"> </td> +</tr> <tr class="t-sdsc"> <td> <code>typeof(</code> <span class="t-spar">expression</span> <code>)</code> </td> <td> (2) </td> <td class="t-sdsc-nopad"> </td> +</tr> <tr class="t-sdsc"> <td> <code>typeof_unqual(</code> <span class="t-spar">type</span> <code>)</code> </td> <td> (3) </td> <td class="t-sdsc-nopad"> </td> +</tr> <tr class="t-sdsc"> <td> <code>typeof_unqual(</code> <span class="t-spar">expression</span> <code>)</code> </td> <td> (4) </td> <td class="t-sdsc-nopad"> </td> +</tr> +</table> <h3 id="Explanation"> Explanation</h3> <div class="t-li1"> +<span class="t-li">1)</span> produces the type-name with any nested typeof-specifier evaluated </div> <div class="t-li1"> +<span class="t-li">2)</span> yields the type-name representing the type of its operand. No implicit conversions are applied to <span class="t-spar">expression</span>.</div> <div class="t-li1"> +<span class="t-li">3,4)</span> the same as <span class="t-v">(1)</span> and <span class="t-v">(2)</span> respectively but remove qualifiers</div> <h3 id="Notes"> Notes</h3> <p><code>typeof</code> and <code>typeof_unqual</code> are collectively called the <i>typeof operators</i>. The <code>typeof</code> operators cannot be applied to bit-field members. If the type of the operand is a variably modified type, the operand is evaluated; otherwise, the operand is not evaluated. The result of the <code>typeof_unqual</code> operator is the non-atomic unqualified type that would result from the <code>typeof</code> operator. The <code>typeof</code> operator preserves all qualifiers.</p> +<h3 id="Example"> Example</h3> <h3 id="References"> References</h3> <ul> +<li> C23 standard (ISO/IEC 9899:2023): </li> +<ul><li> 6.7.2.5 The typeof specifiers (p: 115-118) </li></ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/language/decltype" title="cpp/language/decltype">C++ documentation</a></span> for <code>decltype</code> </td> +</tr> </table> <div class="_attribution"> + <p class="_attribution-p"> + © cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br> + <a href="https://en.cppreference.com/w/c/language/typeof" class="_attribution-link">https://en.cppreference.com/w/c/language/typeof</a> + </p> +</div> |
