<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3827: Deprecate &lt;stdalign.h&gt; and &lt;stdbool.h&gt; macros</title>
<meta property="og:title" content="Issue 3827: Deprecate &lt;stdalign.h&gt; and &lt;stdbool.h&gt; macros">
<meta property="og:description" content="C++ library issue. Status: C++23">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3827.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#C++23">C++23</a> status.</em></p>
<h3 id="3827"><a href="lwg-defects.html#3827">3827</a>. Deprecate <code>&lt;stdalign.h&gt;</code> and <code>&lt;stdbool.h&gt;</code> macros</h3>
<p><b>Section:</b> 17.15.4 <a href="https://wg21.link/stdalign.h.syn">[stdalign.h.syn]</a>, 17.15.5 <a href="https://wg21.link/stdbool.h.syn">[stdbool.h.syn]</a> <b>Status:</b> <a href="lwg-active.html#C++23">C++23</a>
 <b>Submitter:</b> GB <b>Opened:</b> 2022-11-10 <b>Last modified:</b> 2024-01-29</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++23">C++23</a> status.</p>
<p><b>Discussion:</b></p>
<p>
This is the resolution for NB comments:
<ul>
<li><b><a href="https://github.com/cplusplus/nbballot/issues/454">GB-081</a></b> 17.14.4 [stdalign.h.syn] Deprecate contents of &lt;stdalign.h&gt;.
</li>
<li><b><a href="https://github.com/cplusplus/nbballot/issues/453">GB-082</a></b> 17.14.5 [stdbool.h.syn] Deprecate contents of &lt;stdbool.h&gt;.
</li>
</ul>
</p>

<p><b>GB-081:</b></p>
<p>
C2x defines <code>alignas</code> as a keyword, so <code>&lt;stdalign.h&gt;</code> is empty in C2x. C++23 should 
deprecate the <code>__alignas_is_defined</code> macro now, rather than wait until a future C++ standard is based on C2x. 
That gives users longer to prepare for the removal of the macro.
</p>
<p>Recommended change:
Deprecate <code>__alignas_is_defined</code> and move it to Annex D.
Maybe keep a note in 17.15.4 <a href="https://wg21.link/stdalign.h.syn">[stdalign.h.syn]</a>
that the macro is present but deprecated.
</p>

<p><b>GB-082:</b></p>
<p>
C2x supports <code>bool</code> as a built-in type, and <code>true</code> and <code>false</code> as keywords. 
Consequently, C2x marks the <code>__bool_true_false_are_defined</code> as obsolescent. C++23 should 
deprecate that attribute now, rather than wait until a future C++ standard is based on C2x. That 
gives users longer to prepare for the removal of the macro.
</p>
<p>Recommended change:
Deprecate <code>__bool_true_false_are_defined</code> and move it to Annex D.
Maybe keep a note in 17.15.5 <a href="https://wg21.link/stdbool.h.syn">[stdbool.h.syn]</a> that the macro is present but deprecated.
</p>

<p><i>[Kona 2022-11-10; Jonathan provides wording]</i></p>

<p><i>[Kona 2022-11-10; Waiting for LEWG electronic polling]</i></p>


<p><i>[2022-11-08; Kona LEWG]</i></p>

<p>Strong consensus to accept GB-81. Strong consensus to accept GB-82.</p>

<p><strong>Previous resolution [SUPERSEDED]:</strong></p>
<blockquote class="note">
<p>
This wording is relative to <a href="https://wg21.link/N4917" title=" Working Draft, Standard for Programming Language C++">N4917</a>.
</p>

<ol>
<li><p>Modify 17.15.4 <a href="https://wg21.link/stdalign.h.syn">[stdalign.h.syn]</a> as indicated:</p>

<blockquote>
<p><b>17.14.4 Header <code>&lt;stdalign.h&gt;</code> synopsis [stdalign.h.syn]</b></p>

<blockquote><pre>
<del>#define __alignas_is_defined 1</del>
</pre></blockquote>
<p>-1- The contents of the C++ header <code>&lt;stdalign.h&gt;</code> are the same
as the C standard library header <code>&lt;stdalign.h&gt;</code>, with the
following changes:
The header <code>&lt;stdalign.h&gt;</code> does not define
a macro named <code>alignas</code>.
<ins>
The macro <code>__alignas_is_defined</code> (D.11 <a href="https://wg21.link/depr.c.macros">[depr.c.macros]</a>) is deprecated.
</ins>
</p>
<p><span style="font-variant: small-caps">See also</span>: ISO C 7.15</p>
</blockquote>

</li>

<li><p>Modify 17.15.5 <a href="https://wg21.link/stdbool.h.syn">[stdbool.h.syn]</a> as indicated:</p>

<blockquote>
<p><b>17.14.5 Header <code>&lt;stdbool.h&gt;</code> synopsis [stdbool.h.syn]</b></p>

<blockquote><pre>
<del>#define __bool_true_false_are_defined 1</del>
</pre></blockquote>
<p>-1- The contents of the C++ header <code>&lt;stdbool.h&gt;</code> are the same
as the C standard library header <code>&lt;stdbool.h&gt;</code>, with the
following changes:
The header <code>&lt;stdbool.h&gt;</code> does not define
macros named <code>bool</code>, <code>true</code>, or <code>false</code>.
<ins>
The macro <code>__bool_true_false_are_defined</code>
(D.11 <a href="https://wg21.link/depr.c.macros">[depr.c.macros]</a>) is deprecated.
</ins>
</p>
<p><span style="font-variant: small-caps">See also</span>: ISO C 7.18</p>
</blockquote>
</li>

<li>Add a new subclause to Annex D <a href="https://wg21.link/depr">[depr]</a> between
 [depr.res.on.required] and
D.14 <a href="https://wg21.link/depr.relops">[depr.relops]</a>, with this content:

<blockquote>
<ins>
<p><ins><b>D?? Deprecated C macros [depr.c.macros]</b></ins></p>
<p>
<ins>-1- The header <code>&lt;stdalign.h&gt;</code> has the following macro:</ins>
</p>
<blockquote><pre>
<ins>#define __alignas_is_defined 1</ins>
</pre></blockquote>
<p>
<ins>-2- The header <code>&lt;stdbool.h&gt;</code> has the following macro:</ins>
</p>
<blockquote><pre>
<ins>#define __bool_true_false_are_defined 1</ins>
</pre></blockquote>
</ins>

</blockquote>
</li>
</ol>

</blockquote>

<p><i>[Issaquah 2023-02-06; LWG]</i></p>

<p>
Green text additions in Clause 17 was supposed to be adding notes.
Drop them instead.
Unanimous consent (14/0/0) to move to Immediate for C++23.
</p>

<p><i>[2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Immediate &rarr; WP.]</i></p>



<p id="res-3827"><b>Proposed resolution:</b></p>
<p>
This wording is relative to <a href="https://wg21.link/N4928" title=" Working Draft, Standard for Programming Language C++">N4928</a>.
</p>

<ol>
<li><p>Modify 17.15.4 <a href="https://wg21.link/stdalign.h.syn">[stdalign.h.syn]</a> as indicated:</p>

<blockquote>
<p><b>17.14.4 Header <code>&lt;stdalign.h&gt;</code> synopsis [stdalign.h.syn]</b></p>

<blockquote><pre>
<del>#define __alignas_is_defined 1</del>
</pre></blockquote>
<p>-1- The contents of the C++ header <code>&lt;stdalign.h&gt;</code> are the same
as the C standard library header <code>&lt;stdalign.h&gt;</code>, with the
following changes:
The header <code>&lt;stdalign.h&gt;</code> does not define
a macro named <code>alignas</code>.
</p>
<p><span style="font-variant: small-caps">See also</span>: ISO C 7.15</p>
</blockquote>

</li>

<li><p>Modify 17.15.5 <a href="https://wg21.link/stdbool.h.syn">[stdbool.h.syn]</a> as indicated:</p>

<blockquote>
<p><b>17.14.5 Header <code>&lt;stdbool.h&gt;</code> synopsis [stdbool.h.syn]</b></p>

<blockquote><pre>
<del>#define __bool_true_false_are_defined 1</del>
</pre></blockquote>
<p>-1- The contents of the C++ header <code>&lt;stdbool.h&gt;</code> are the same
as the C standard library header <code>&lt;stdbool.h&gt;</code>, with the
following changes:
The header <code>&lt;stdbool.h&gt;</code> does not define
macros named <code>bool</code>, <code>true</code>, or <code>false</code>.
</p>
<p><span style="font-variant: small-caps">See also</span>: ISO C 7.18</p>
</blockquote>
</li>

<li>Add a new subclause to Annex D <a href="https://wg21.link/depr">[depr]</a> between
 [depr.res.on.required] and
D.14 <a href="https://wg21.link/depr.relops">[depr.relops]</a>, with this content:

<blockquote>
<ins>
<p><ins><b>D?? Deprecated C macros [depr.c.macros]</b></ins></p>
<p>
<ins>-1- The header <code>&lt;stdalign.h&gt;</code> has the following macro:</ins>
</p>
<blockquote><pre>
<ins>#define __alignas_is_defined 1</ins>
</pre></blockquote>
<p>
<ins>-2- The header <code>&lt;stdbool.h&gt;</code> has the following macro:</ins>
</p>
<blockquote><pre>
<ins>#define __bool_true_false_are_defined 1</ins>
</pre></blockquote>
</ins>

</blockquote>
</li>
</ol>






</body>
</html>
