summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/incomplete-enums.html
blob: 8f46ebe990f6c7454a21359ba391f9394d321d29 (plain)
1
2
3
4
5
6
<div class="section-level-extent" id="Incomplete-Enums"> <div class="nav-panel"> <p> Next: <a href="function-names" accesskey="n" rel="next">Function Names as Strings</a>, Previous: <a href="alternate-keywords" accesskey="p" rel="prev">Alternate Keywords</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="Incomplete-enum-Types"><span>6.49 Incomplete enum Types<a class="copiable-link" href="#Incomplete-enum-Types"> ¶</a></span></h1> <p>You can define an <code class="code">enum</code> tag without specifying its possible values. This results in an incomplete type, much like what you get if you write <code class="code">struct foo</code> without describing the elements. A later declaration that does specify the possible values completes the type. </p> <p>You cannot allocate variables or storage using the type while it is incomplete. However, you can work with pointers to that type. </p> <p>This extension may not be very useful, but it makes the handling of <code class="code">enum</code> more consistent with the way <code class="code">struct</code> and <code class="code">union</code> are handled. </p> <p>This extension is not supported by GNU C++. </p> </div><div class="_attribution">
  <p class="_attribution-p">
    &copy; 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/Incomplete-Enums.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Incomplete-Enums.html</a>
  </p>
</div>