<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2820: Clarify &lt;cstdint&gt; macros</title>
<meta property="og:title" content="Issue 2820: Clarify &lt;cstdint&gt; macros">
<meta property="og:description" content="C++ library issue. Status: C++23">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2820.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="2820"><a href="lwg-defects.html#2820">2820</a>. Clarify <code>&lt;cstdint&gt;</code> macros</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> Thomas K&ouml;ppe <b>Opened:</b> 2016-11-12 <b>Last modified:</b> 2023-11-22</p>
<p><b>Priority: </b>3
</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>
I would like clarification from LWG regarding the various limit macros like <code>INT_8_MIN</code> in <code>&lt;cstdint&gt;</code>, 
in pursuit of editorial cleanup of this header's synopsis. I have two questions:
</p>
<ol>
<li><p>At present, macros like <code>INT_8_MIN</code> that correspond to the optional type <code>int8_t</code> are required 
(unconditionally), whereas the underlying type to which they appertain is only optional. Is this deliberate? 
Should the macros also be optional?</p></li>
<li><p>Is it deliberate that C++ only specifies sized aliases for the sizes 8, 16, 32 and 64, whereas the corresponding 
C header allows type aliases and macros for arbitrary sizes for implementations that choose to provide extended integer 
types? Is the C++ wording more restrictive by accident?</p></li>
</ol>

<p><i>[2017-01-27 Telecon]</i></p>

<p>Priority 3</p>

<p><i>[2017-03-04, Kona]</i></p>

<p>C11 ties the macro names to the existence of the types. Marshall to research the second question.</p>
<p>Close <a href="lwg-closed.html#2764" title="Are &lt;cstddint&gt; macros optional? (Status: Dup)">2764</a><sup><a href="https://cplusplus.github.io/LWG/issue2764" title="Latest snapshot">(i)</a></sup> as a duplicate of this issue.</p>

<p><i>[2017-03-18, Thomas comments and provides wording]</i></p>

<p>
This is as close as I can get to the C wording without resolving part (a) of the issue (whether we deliberately don't 
allow sized type aliases for sizes other than 8, 16, 32, 64, a departure from C). Once we resolve part (a), we need 
to revisit <code>&lt;cinttypes&gt;</code> and fix up the synopsis (perhaps to get rid of <code>N</code>) and add similar 
wording as the one below to make the formatting macros for the fixed-width types optional. For historical interest,
this issue is related to LWG <a href="lwg-closed.html#553" title="very minor editorial change intptr_t / uintptr_t (Status: NAD Editorial)">553</a><sup><a href="https://cplusplus.github.io/LWG/issue553" title="Latest snapshot">(i)</a></sup> and LWG <a href="lwg-closed.html#841" title="cstdint.syn inconsistent with C99 (Status: NAD Editorial)">841</a><sup><a href="https://cplusplus.github.io/LWG/issue841" title="Latest snapshot">(i)</a></sup>.
</p>

<p><i>[2016-07, Toronto Saturday afternoon issues processing]</i></p>

<p>Status to Open</p>

<strong>Previous resolution: [SUPERSEDED]</strong>

<blockquote class="note">
<p>
This wording is relative to <a href="https://wg21.link/n4640">N4640</a>.
</p>

<ol>
<li><p>Append the following content to 17.4.1 <a href="https://wg21.link/cstdint.syn">[cstdint.syn]</a> p2:</p>

<blockquote>
<p>
-2- The header defines all types and macros the same as the C standard library header <code>&lt;stdint.h&gt;</code>.
<ins>In particular, for each of the fixed-width types (<code>int8_t</code>, <code>int16_t</code>, <code>int32_t</code>, 
<code>int64_t</code>, <code>uint8_t</code>, <code>uint16_t</code>, <code>uint32_t</code>, <code>uint64_t</code>) the type alias and 
the corresponding limit macros are defined if and only if the implementation provides the corresponding type.</ins>
</p>
</blockquote>
</li>
</ol>
</blockquote>

<p><i>[2017-10-21, Thomas K&ouml;ppe provides improved wording]</i></p>


<p><strong>Previous resolution [SUPERSEDED]:</strong></p>
<blockquote class="note">
<p>
<p>This wording is relative to <a href="https://wg21.link/n4687">N4687</a>.</p>
</p>

<ol>
<li><p>Change 17.4.1 <a href="https://wg21.link/cstdint.syn">[cstdint.syn]</a>, header <code>&lt;cstdint&gt;</code> synopsis, as indicated:</p>

<blockquote>
<pre>
[&hellip;]
using int64_t = <i>signed integer type</i>; <i>// optional</i>
<ins>using int<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using int_fast64_t = <i>signed integer type</i>;
<ins>using int_fast<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using int_least64_t = <i>signed integer type</i>;
<ins>using int_least<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using uint64_t = <i>unsigned integer type</i>; <i>// optional</i>
<ins>using uint<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using uint_fast64_t = <i>unsigned integer type</i>;
<ins>using uint_fast<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using uint_least64_t = <i>unsigned integer type</i>;
<ins>using uint_least<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>

using uintmax_t = <i>unsigned integer type</i>;
using uintptr_t = <i>unsigned integer type</i>; <i>// optional</i>

<ins>#define INT_<i>N</i>_MIN  <i>see below</i>;
#define INT_<i>N</i>_MAX  <i>see below</i>;
#define UINT_<i>N</i>_MAX  <i>see below</i>;

#define INT_FAST<i>N</i>_MIN  <i>see below</i>;
#define INT_FAST<i>N</i>_MAX  <i>see below</i>;
#define UINT_FAST<i>N</i>_MAX  <i>see below</i>;

#define INT_LEAST<i>N</i>_MIN  <i>see below</i>;
#define INT_LEAST<i>N</i>_MAX  <i>see below</i>;
#define UINT_LEAST<i>N</i>_MAX  <i>see below</i>;

#define INTMAX_MIN  <i>see below</i>;
#define INTMAX_MAX  <i>see below</i>;
#define UINTMAX_MAX  <i>see below</i>;

#define INTPTR_MIN  <i>see below</i>;
#define INTPTR_MAX  <i>see below</i>;
#define UINTPTR_MAX  <i>see below</i>;

#define PTRDIFF_MIN  <i>see below</i>;
#define PTRDIFF_MAX  <i>see below</i>;
#define SIZE_MAX  <i>see below</i>;

#define SIGATOMIC_MIN  <i>see below</i>;
#define SIGATOMIC_MAX  <i>see below</i>;

#define WCHAR_MIN  <i>see below</i>;
#define WCHAR_MAX  <i>see below</i>;

#define WINT_MIN  <i>see below</i>;
#define WINT_MAX  <i>see below</i>;

#define INT<i>N</i>_C(value)  <i>see below</i>;
#define UINT<i>N</i>_C(value)  <i>see below</i>;
#define INTMAX_C(value)  <i>see below</i>;
#define UINTMAX_C(value)  <i>see below</i>;</ins>
</pre>
<p>
<del>-1- The header also defines numerous macros of the form:</del>
</p>
<blockquote><pre>
<del>INT_[FAST LEAST]{8 16 32 64}_MIN
[U]INT_[FAST LEAST]{8 16 32 64}_MAX
INT{MAX PTR}_MIN
[U]INT{MAX PTR}_MAX
{PTRDIFF SIG_ATOMIC WCHAR WINT}{_MAX _MIN}
SIZE_MAX</del>
</pre></blockquote>
<p>
<del>plus function macros of the form:</del>
</p>
<blockquote><pre>
<del>[U]INT{8 16 32 64 MAX}_C</del>
</pre></blockquote>
<p>
-2- The header defines all types and macros the same as the C standard library header <code>&lt;stdint.h&gt;</code>.
<span style="font-variant: small-caps;">See also</span>: ISO C 7.20
<p/>
<ins>-?- In particular, all types that use the placeholder <code><i>N</i></code> are optional when <code><i>N</i></code> is not 8, 
16, 32 or 64. The exact-width types <code>int<i>N</i>_t</code> and <code>uint<i>N</i>_t</code> for <code><i>N</i></code> = 8, 16, 32, 64 
are also optional; however, if an implementation provides integer types with the corresponding width, no padding bits, and 
(for the signed types) that have a two's complement representation, it defines the corresponding typedef names. Only 
those macros are defined that correspond to typedef names that the implementation actually provides. [<i>Note:</i> The macros 
<code>INT<i>N</i>_C</code> and <code>UINT<i>N</i>_C</code> correspond to the typedef names <code>int_least<i>N</i>_t</code> and 
<code>uint_least<i>N</i>_t</code>, respectively. &mdash; <i>end note</i>]</ins>
</p>
</blockquote>
</li>

<li><p>Change 31.13.2 <a href="https://wg21.link/cinttypes.syn">[cinttypes.syn]</a> as indicated:</p>

<blockquote><pre>
#define PRId<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIi<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIo<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIu<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIx<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIX<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNd<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNi<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNo<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNu<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNx<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIdLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIiLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIoLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIuLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIxLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIXLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNdLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNiLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNoLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNuLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNxLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIdFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIiFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIoFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIuFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIxFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIXFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNdFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNiFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNoFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNuFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNxFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
[&hellip;]
</pre>
<p>
-1- The contents and meaning of the header <code>&lt;cinttypes&gt;</code> [&hellip;]
<p/>
<ins>-?- In particular, macros that use the placeholder <code><i>N</i></code> are defined if and only if the implementation 
actually provides the corresponding typedef name in 17.4.1 <a href="https://wg21.link/cstdint.syn">[cstdint.syn]</a>, and moreover, the <code>fscanf</code> macros 
are provided unless the implementation does not have a suitable <code>fscanf</code> length modifier for the type.</ins>
</p>
</blockquote>
</li>
</ol>
</blockquote>

<p><i>[2018-04-03; Geoffrey Romer suggests improved wording]</i></p>


<p><strong>Previous resolution [SUPERSEDED]:</strong></p>
<blockquote class="note">
<p>
This wording is relative to <a href="https://wg21.link/n4727">N4727</a>.
</p>

<ol>
<li><p>Change 17.4.1 <a href="https://wg21.link/cstdint.syn">[cstdint.syn]</a>, header <code>&lt;cstdint&gt;</code> synopsis, as indicated:</p>

<blockquote>
<pre>
[&hellip;]
using int64_t = <i>signed integer type</i>; <i>// optional</i>
<ins>using int<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using int_fast64_t = <i>signed integer type</i>;
<ins>using int_fast<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using int_least64_t = <i>signed integer type</i>;
<ins>using int_least<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using uint64_t = <i>unsigned integer type</i>; <i>// optional</i>
<ins>using uint<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using uint_fast64_t = <i>unsigned integer type</i>;
<ins>using uint_fast<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using uint_least64_t = <i>unsigned integer type</i>;
<ins>using uint_least<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>

using uintmax_t = <i>unsigned integer type</i>;
using uintptr_t = <i>unsigned integer type</i>; <i>// optional</i>

<ins>#define INT_<i>N</i>_MIN  <i>see below</i>;
#define INT_<i>N</i>_MAX  <i>see below</i>;
#define UINT_<i>N</i>_MAX  <i>see below</i>;

#define INT_FAST<i>N</i>_MIN  <i>see below</i>;
#define INT_FAST<i>N</i>_MAX  <i>see below</i>;
#define UINT_FAST<i>N</i>_MAX  <i>see below</i>;

#define INT_LEAST<i>N</i>_MIN  <i>see below</i>;
#define INT_LEAST<i>N</i>_MAX  <i>see below</i>;
#define UINT_LEAST<i>N</i>_MAX  <i>see below</i>;

#define INTMAX_MIN  <i>see below</i>;
#define INTMAX_MAX  <i>see below</i>;
#define UINTMAX_MAX  <i>see below</i>;

#define INTPTR_MIN  <i>see below</i>;
#define INTPTR_MAX  <i>see below</i>;
#define UINTPTR_MAX  <i>see below</i>;

#define PTRDIFF_MIN  <i>see below</i>;
#define PTRDIFF_MAX  <i>see below</i>;
#define SIZE_MAX  <i>see below</i>;

#define SIGATOMIC_MIN  <i>see below</i>;
#define SIGATOMIC_MAX  <i>see below</i>;

#define WCHAR_MIN  <i>see below</i>;
#define WCHAR_MAX  <i>see below</i>;

#define WINT_MIN  <i>see below</i>;
#define WINT_MAX  <i>see below</i>;

#define INT<i>N</i>_C(value)  <i>see below</i>;
#define UINT<i>N</i>_C(value)  <i>see below</i>;
#define INTMAX_C(value)  <i>see below</i>;
#define UINTMAX_C(value)  <i>see below</i>;</ins>
</pre>
<p>
<del>-1- The header also defines numerous macros of the form:</del>
</p>
<blockquote><pre>
<del>INT_[FAST LEAST]{8 16 32 64}_MIN
[U]INT_[FAST LEAST]{8 16 32 64}_MAX
INT{MAX PTR}_MIN
[U]INT{MAX PTR}_MAX
{PTRDIFF SIG_ATOMIC WCHAR WINT}{_MAX _MIN}
SIZE_MAX</del>
</pre></blockquote>
<p>
<del>plus function macros of the form:</del>
</p>
<blockquote><pre>
<del>[U]INT{8 16 32 64 MAX}_C</del>
</pre></blockquote>
<p>
-2- The header defines all types and macros the same as the C standard library header <code>&lt;stdint.h&gt;</code>.
<span style="font-variant: small-caps;">See also</span>: ISO C 7.20
<p/>
<ins>-?- In particular, all types that use the placeholder <code><i>N</i></code> are optional when <code><i>N</i></code> is not 8, 
16, 32 or 64. The exact-width types <code>int<i>N</i>_t</code> and <code>uint<i>N</i>_t</code> for <code><i>N</i></code> = 8, 16, 32, 64 
are also optional; however, if an implementation provides integer types with the corresponding width, no padding bits, and 
(for the signed types) that have a two's complement representation, it defines the corresponding typedef names. Only 
those macros are defined that correspond to typedef names that the implementation actually provides. [<i>Note:</i> The macros 
<code>INT<i>N</i>_C</code> and <code>UINT<i>N</i>_C</code> correspond to the typedef names <code>int_least<i>N</i>_t</code> and 
<code>uint_least<i>N</i>_t</code>, respectively. &mdash; <i>end note</i>]</ins>
</p>
</blockquote>
</li>

<li><p>Change 31.13.2 <a href="https://wg21.link/cinttypes.syn">[cinttypes.syn]</a> as indicated:</p>

<blockquote><pre>
#define PRId<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIi<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIo<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIu<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIx<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIX<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNd<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNi<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNo<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNu<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNx<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIdLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIiLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIoLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIuLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIxLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIXLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNdLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNiLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNoLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNuLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNxLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIdFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIiFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIoFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIuFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIxFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIXFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNdFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNiFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNoFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNuFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNxFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
[&hellip;]
</pre>
<p>
-1- The contents and meaning of the header <code>&lt;cinttypes&gt;</code> [&hellip;]
<p/>
<ins>-?- <code>PRI</code> macros that use the placeholder <code><i>N</i></code> are defined if and only if the implementation actually 
provides the corresponding typedef name in 17.4.1 <a href="https://wg21.link/cstdint.syn">[cstdint.syn]</a>. <code>SCN</code> macros that use the placeholder 
<code><i>N</i></code> are defined if and only if the implementation actually provides the corresponding typedef name 
and the implementation has a suitable <code>fscanf</code> length modifier for the type.</ins>
</p>
</blockquote>
</li>
</ol></blockquote>

<p><i>[2019-03-11; Reflector review and improved wording]</i></p>

<p>
Wording simplifications due to new general two's complement requirements of integer types; removal of wording
redundancies and applying some typo fixes in macro names.
</p>

<p><i>[2019-03-16; Daniel comments and updates wording]</i></p>

<p>
Hubert Tong pointed out that we do not have a statement about <code>[U]INTPTR_{MIN|MAX}</code> being optional.
Interestingly, the C11 Standard does not say directly that the <code>[U]INTPTR_{MIN|MAX}</code> macros are optional,
but this follows indirectly from the fact that <code>intptr_t</code> and <code>uintptr_t</code> are indeed optional. 
The updated wording therefore realizes Hubert's suggestion.
<p/>
In addition, the reference document has been rebased to <a href="https://wg21.link/n4810">N4810</a>, because
that draft version contains an <a href="https://github.com/cplusplus/draft/pull/2638">editorial change</a>, 
which renames the term "range exponent" of integer types to "width", which is the vocabulary used below and
also matches C's use.
<p/>
Finally, Hubert Tong suggested the following rewording replacements of
</p>
<blockquote><p>
If and only if the implementation defines such a typedef name, it also defines the corresponding macros.
</p></blockquote>
<p>
to:
</p>
<blockquote><p>
Each of the macros listed in this subclause is defined if and only if the implementation defines the corresponding typedef name.
</p></blockquote>
<p>
and of
</p>
<blockquote><p>
<code>PRI</code> macros that use the placeholder N are defined if and only if the implementation actually defines the 
corresponding typedef name in 17.4.1 <a href="https://wg21.link/cstdint.syn">[cstdint.syn]</a>. <code>SCN</code> macros that use the placeholder <code><i>N</i></code> 
are defined if and only if the implementation actually defines the corresponding typedef name and the implementation 
has a suitable <code>fscanf</code> length modifier for the type.
</p></blockquote>
<p>
to:
</p>
<blockquote><p>
Each of the macros listed in this subclause is defined if and only if the implementation actually defines the corresponding 
typedef name in 17.4.1 <a href="https://wg21.link/cstdint.syn">[cstdint.syn]</a>.
</p></blockquote>
<p>
Those changes have been applied as well.
</p>

<p><i>[2019-03-26; Reflector discussion and minor wording update]</i></p>

<p>
Geoffrey pointed out that the revised wording has the effect that it requires an implementation to define <code>SCN</code>
macros for all mentioned typedefs, but the C11 standard says "the corresponding <code>fscanf</code> macros shall be
defined unless the implementation does not have a suitable <code>fscanf</code> length modifier for the type.". An additional 
wording update repairs this problem below.
</p>

<p><i>[2020-02-22; Reflector discussion]</i></p>

<p>
Status set to Tentatively Ready after seven positive votes on the reflector.
</p>
<p><i>[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready &rarr; WP.]</i></p>



<p id="res-2820"><b>Proposed resolution:</b></p>
<p>
This wording is relative to <a href="https://wg21.link/n4849">N4849</a>.
</p>

<ol>
<li><p>Change 17.4.1 <a href="https://wg21.link/cstdint.syn">[cstdint.syn]</a>, header <code>&lt;cstdint&gt;</code> synopsis, as indicated:</p>

<blockquote>
<pre>
[&hellip;]
using int64_t = <i>signed integer type</i>; <i>// optional</i>
<ins>using int<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using int_fast64_t = <i>signed integer type</i>;
<ins>using int_fast<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using int_least64_t = <i>signed integer type</i>;
<ins>using int_least<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using uint64_t = <i>unsigned integer type</i>; <i>// optional</i>
<ins>using uint<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using uint_fast64_t = <i>unsigned integer type</i>;
<ins>using uint_fast<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>
[&hellip;]
using uint_least64_t = <i>unsigned integer type</i>;
<ins>using uint_least<i>N</i>_t = <i>see below</i>; <i>// optional, see below</i></ins>

using uintmax_t = <i>unsigned integer type</i>;
using uintptr_t = <i>unsigned integer type</i>; <i>// optional</i>

<ins>#define INT<i>N</i>_MIN  <i>see below</i>
#define INT<i>N</i>_MAX  <i>see below</i>
#define UINT<i>N</i>_MAX  <i>see below</i>

#define INT_FAST<i>N</i>_MIN  <i>see below</i>
#define INT_FAST<i>N</i>_MAX  <i>see below</i>
#define UINT_FAST<i>N</i>_MAX  <i>see below</i>

#define INT_LEAST<i>N</i>_MIN  <i>see below</i>
#define INT_LEAST<i>N</i>_MAX  <i>see below</i>
#define UINT_LEAST<i>N</i>_MAX  <i>see below</i>

#define INTMAX_MIN  <i>see below</i>
#define INTMAX_MAX  <i>see below</i>
#define UINTMAX_MAX  <i>see below</i>

#define INTPTR_MIN  <i>optional, see below</i>
#define INTPTR_MAX  <i>optional, see below</i>
#define UINTPTR_MAX  <i>optional, see below</i>

#define PTRDIFF_MIN  <i>see below</i>
#define PTRDIFF_MAX  <i>see below</i>
#define SIZE_MAX  <i>see below</i>

#define SIG_ATOMIC_MIN  <i>see below</i>
#define SIG_ATOMIC_MAX  <i>see below</i>

#define WCHAR_MIN  <i>see below</i>
#define WCHAR_MAX  <i>see below</i>

#define WINT_MIN  <i>see below</i>
#define WINT_MAX  <i>see below</i>

#define INT<i>N</i>_C(value)  <i>see below</i>
#define UINT<i>N</i>_C(value)  <i>see below</i>
#define INTMAX_C(value)  <i>see below</i>
#define UINTMAX_C(value)  <i>see below</i></ins>
</pre>
<p>
<del>-1- The header also defines numerous macros of the form:</del>
</p>
<blockquote><pre>
<del>INT_[FAST LEAST]{8 16 32 64}_MIN
[U]INT_[FAST LEAST]{8 16 32 64}_MAX
INT{MAX PTR}_MIN
[U]INT{MAX PTR}_MAX
{PTRDIFF SIG_ATOMIC WCHAR WINT}{_MAX _MIN}
SIZE_MAX</del>
</pre></blockquote>
<p>
<del>plus function macros of the form:</del>
</p>
<blockquote><pre>
<del>[U]INT{8 16 32 64 MAX}_C</del>
</pre></blockquote>
<p>
-2- The header defines all types and macros the same as the C standard library header <code>&lt;stdint.h&gt;</code>.
<span style="font-variant: small-caps;">See also</span>: ISO C 7.20
<p/>
<ins>-?- All types that use the placeholder <code><i>N</i></code> are optional when <code><i>N</i></code> is not 8, 
16, 32 or 64. The exact-width types <code>int<i>N</i>_t</code> and <code>uint<i>N</i>_t</code> for <code><i>N</i></code> = 8, 16, 32, 64 
are also optional; however, if an implementation defines integer types with the corresponding width and no padding bits, 
it defines the corresponding typedef names. Each of the macros listed in this subclause is defined if and only if 
the implementation defines the corresponding typedef name. [<i>Note:</i> The macros <code>INT<i>N</i>_C</code> and 
<code>UINT<i>N</i>_C</code> correspond to the typedef names <code>int_least<i>N</i>_t</code> and <code>uint_least<i>N</i>_t</code>, 
respectively. &mdash; <i>end note</i>]</ins>
</p>
</blockquote>
</li>

<li><p>Change 31.13.2 <a href="https://wg21.link/cinttypes.syn">[cinttypes.syn]</a> as indicated:</p>

<blockquote><pre>
#define PRId<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIi<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIo<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIu<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIx<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIX<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNd<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNi<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNo<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNu<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNx<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIdLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIiLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIoLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIuLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIxLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIXLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNdLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNiLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNoLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNuLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNxLEAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIdFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIiFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIoFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIuFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIxFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define PRIXFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNdFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNiFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNoFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNuFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
#define SCNxFAST<del>N</del><ins><i>N</i></ins> <i>see below</i>
[&hellip;]
</pre>
<p>
-1- The contents and meaning of the header <code>&lt;cinttypes&gt;</code> [&hellip;]
<p/>
<ins>-?- Each of the <code>PRI</code> macros listed in this subclause is defined if and only if the implementation defines the 
corresponding typedef name in 17.4.1 <a href="https://wg21.link/cstdint.syn">[cstdint.syn]</a>. Each of the <code>SCN</code> macros listed in this subclause is 
defined if and only if the implementation defines the corresponding typedef name in 17.4.1 <a href="https://wg21.link/cstdint.syn">[cstdint.syn]</a> and
has a suitable <code>fscanf</code> length modifier for the type.</ins>
</p>
</blockquote>
</li>
</ol>





</body>
</html>
