diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
| commit | 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch) | |
| tree | 158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/c/language%2Fconstexpr.html | |
| parent | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff) | |
| download | dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip | |
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/c/language%2Fconstexpr.html')
| -rw-r--r-- | devdocs/c/language%2Fconstexpr.html | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/devdocs/c/language%2Fconstexpr.html b/devdocs/c/language%2Fconstexpr.html deleted file mode 100644 index 5cffe330..00000000 --- a/devdocs/c/language%2Fconstexpr.html +++ /dev/null @@ -1,33 +0,0 @@ - <h1 id="firstHeading" class="firstHeading">constexpr specifier <span class="t-mark-rev t-since-c23">(since C23)</span> -</h1> <p>A scalar object declared with the <code>constexpr</code> storage-class specifier is a <a href="constant_expression" title="c/language/constant expression">constant</a>. It must be fully and explicitly initialized according to the static initialization rules. It still has linkage appropriate to its declaration and it exist at runtime to have its address taken; it simply cannot be modified at runtime in any way, i.e. the compiler can use its knowledge of the object’s fixed value in any other <a href="constant_expression" title="c/language/constant expression">constant expression</a>.</p> -<p>Additionally, the constant expression that is used for the initializer of such a constant is checked at compile time.</p> -<p>An initializer of floating-point type must be evaluated with the translation-time floating-point environment.</p> -<p>There are some restrictions on the type of an object that can be declared with <code>constexpr</code>. Namely, the following constructs are not allowed to be <code>constexpr</code>:</p> -<ul> -<li> <a href="pointer" title="c/language/pointer">Pointers</a> (except that null pointers can be <code>constexpr</code>), </li> -<li> Variably modified types, </li> -<li> <a href="atomic" title="c/language/atomic">Atomic types</a>, </li> -<li> <a href="volatile" title="c/language/volatile"><code>volatile</code></a> types, </li> -<li> <a href="restrict" title="c/language/restrict"><code>restrict</code></a> pointers. </li> -</ul> <h3 id="Keywords"> Keywords</h3> <p><a href="../keyword/constexpr" title="c/keyword/constexpr"><code>constexpr</code></a></p> -<h3 id="Notes"> Notes</h3> <h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <fenv.h> -#include <stdio.h> - -int main(void) -{ - constexpr float f = 23.0f; - constexpr float g = 33.0f; - fesetround(FE_TOWARDZERO); - constexpr float h = f / g; // is not affected by fesetround() above - printf("%f\n", h); -}</pre></div> <p>Output:</p> -<div class="text source-text"><pre data-language="c">0.696969</pre></div> </div> <h3 id="References"> References</h3> <ul> -<li> C23 standard (ISO/IEC 9899:2023): </li> -<ul><li> TBD TBD (p: TBD) </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/constexpr" title="cpp/language/constexpr">C++ documentation</a></span> for <span class=""><span><code>constexpr</code> type specifier</span></span> </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/constexpr" class="_attribution-link">https://en.cppreference.com/w/c/language/constexpr</a> - </p> -</div> |
