<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3828: Sync intmax_t and uintmax_t with C2x</title>
<meta property="og:title" content="Issue 3828: Sync intmax_t and uintmax_t with C2x">
<meta property="og:description" content="C++ library issue. Status: C++23">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3828.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="3828"><a href="lwg-defects.html#3828">3828</a>. Sync <code>intmax_t</code> and <code>uintmax_t</code> with C2x</h3>
<p><b>Section:</b> 17.4.1 <a href="https://wg21.link/cstdint.syn">[cstdint.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> 2023-11-22</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all other</b> <a href="lwg-index.html#cstdint.syn">issues</a> in [cstdint.syn].</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 comment <b><a href="https://github.com/cplusplus/nbballot/issues/454">GB-080</a></b> 
17.4.1 [cstdint.syn] Sync <code>intmax_t</code> and <code>uintmax_t</code> with C2x.
</p>

<p>
With the approval of
<a href="https://www.open-std.org/jtc1/sc22/WG14/www/docs/n2888.htm">WG14 N2888</a>
the next C standard will resolve the long-standing issue that implementations
cannot support 128-bit integer types properly without ABI breaks.
C++ should adopt the same fix now, rather than waiting until a future
C++ standard is rebased on C2x.
</p><p>
31.13.2 <a href="https://wg21.link/cinttypes.syn">[cinttypes.syn]</a> also mentions those types, but doesn't need
a change. The proposed change allows <code>intmax_t</code> to be an
extended integer type of the same width as <code>long long</code>,
in which case we'd still want those <code>abs</code> overloads.
</p><p>
Recommended change:
Add to 31.13.2 <a href="https://wg21.link/cinttypes.syn">[cinttypes.syn]</a> p2 "except that <code>intmax_t</code> is not required to be able to 
represent all values of extended integer types wider than <code>long long</code>, and <code>uintmax_t</code> is not required 
to be able to represent all values of extended integer types wider than <code>unsigned long long</code>."
</p>

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


<p><i>[2022-11; LEWG electronic polling]</i></p>

<p>Unanimous consensus in favor.</p>

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

<p>Unanimous consent (13/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-3828"><b>Proposed resolution:</b></p>
<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 31.13.2 <a href="https://wg21.link/cinttypes.syn">[cinttypes.syn]</a> as indicated:</p>

<blockquote>
<p> -1-
The contents and meaning of the header <code>&lt;cinttypes&gt;</code>
are the same as the C standard library header <code>&lt;inttypes.h&gt;</code>,
with the following changes:
</p>
<ol style="list-style-type: none">
<li><p>(1.1) &mdash;
The header <code>&lt;cinttypes&gt;</code> includes the header
<code>&lt;cstdint&gt;</code> instead of <code>&lt;stdint.h&gt;</code>, and
</p></li>
<li><p><ins>(1.?) &mdash;
<code>intmax_t</code> and <code>uintmax_t</code> are not required to be able to
represent all values of extended integer types wider than <code>long long</code>
and <code>unsigned long long</code> respectively, and
</ins>
</p></li>
<li><p>(1.2) &mdash;
if and only if the type <code>intmax_t</code> designates an extended integer type,
the following function signatures are added:
</p>
<blockquote><pre>
intmax_t abs(intmax_t);
imaxdiv_t div(intmax_t, intmax_t);
</pre></blockquote>
<p>
which shall have the same semantics as the function signatures
<code>intmax_t imaxabs(intmax_t)</code> and
<code>imaxdiv_t imaxdiv(intmax_t, intmax_t)</code>, respectively.
</p></li>
</ol>
<p><span style="font-variant: small-caps">See also</span>: ISO C 7.8</p>
</blockquote>
</li>
</ol>






</body>
</html>
