<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2441: Exact-width atomic typedefs should be provided</title>
<meta property="og:title" content="Issue 2441: Exact-width atomic typedefs should be provided">
<meta property="og:description" content="C++ library issue. Status: C++17">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2441.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++17">C++17</a> status.</em></p>
<h3 id="2441"><a href="lwg-defects.html#2441">2441</a>. Exact-width atomic typedefs should be provided</h3>
<p><b>Section:</b> 32.5.8 <a href="https://wg21.link/atomics.types.generic">[atomics.types.generic]</a> <b>Status:</b> <a href="lwg-active.html#C++17">C++17</a>
 <b>Submitter:</b> Stephan T. Lavavej <b>Opened:</b> 2014-10-01 <b>Last modified:</b> 2017-07-30</p>
<p><b>Priority: </b>0
</p>
<p><b>View all other</b> <a href="lwg-index.html#atomics.types.generic">issues</a> in [atomics.types.generic].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++17">C++17</a> status.</p>
<p><b>Discussion:</b></p>
<p>
<code>&lt;atomic&gt;</code> doesn't provide counterparts for <code>&lt;inttypes.h&gt;</code>'s most useful typedefs, possibly 
because they're quasi-optional. We can easily fix this.
</p>

<p><i>[2014-11, Urbana]</i></p>

<p>
Typedefs were transitional compatibility hack. Should use <code>_Atomic</code> macro or template.
E.g. <code>_Atomic(int8_t)</code>. BUT <code>_Atomic</code> disappeared!</p>

<p>
Detlef will look for <code>_Atomic</code> macro. If missing, will open issue.
</p>

<p><i>[2014-11-25, Hans comments]</i></p>

<p>
There is no <code>_Atomic</code> in C++. This is related to the much more general unanswered question of whether C++17 
should reference C11, C99, or neither.
</p>

<p><i>[2015-02 Cologne]</i></p>

<p>
AM: I think this is still an SG1 issue; they need to deal with it before we do.
</p>

<p><i>[2015-05 Lenexa, SG1 response]</i></p>

<p>
Move to SG1-OK status. This seems like an easy short-term fix. We probably need a paper on C/C++ atomics compatibility 
to deal with <code>_Atomic</code>, but that's a separable issue.
</p>

<p><i>[2015-10 pre-Kona]</i></p>

<p>
SG1 hands this over to LWG for wording review
</p>


<p id="res-2441"><b>Proposed resolution:</b></p>
<p>
This wording is relative to N3936.
</p>

<ol>
<li><p>Change 32.5.8 <a href="https://wg21.link/atomics.types.generic">[atomics.types.generic]</a> p8 as depicted:</p>

<blockquote>
<p>
-8- There shall be atomic typedefs corresponding to the typedefs in the header <code>&lt;inttypes.h&gt;</code> as specified in
Table 147. <ins><code>atomic_int<i>N</i>_t</code>, <code>atomic_uint<i>N</i>_t</code>, <code>atomic_intptr_t</code>, and 
<code>atomic_uintptr_t</code> shall be defined if and only if <code>int<i>N</i>_t</code>, <code>uint<i>N</i>_t</code>, <code>intptr_t</code>, 
and <code>uintptr_t</code> are defined, respectively.</ins>
</p>
</blockquote></li>

<li><p>Change 99 [atomics.types.operations.req], Table 147 ("<code>atomic</code> <code>&lt;inttypes.h&gt;</code> 
typedefs"), as depicted:</p>

<blockquote>
<table border="1">
<caption>Table 147 &mdash; <code>atomic</code> <code>&lt;inttypes.h&gt;</code> typedefs</caption>
<tr>
<th>Atomic typedef</th>
<th><code>&lt;inttypes.h&gt;</code> type</th>
</tr>

<tr>
<td>
<ins><code>atomic_int8_t</code></ins>
</td>
<td>
<ins><code>int8_t</code></ins>
</td>
</tr>

<tr>
<td>
<ins><code>atomic_uint8_t</code></ins>
</td>
<td>
<ins><code>uint8_t</code></ins>
</td>
</tr>

<tr>
<td>
<ins><code>atomic_int16_t</code></ins>
</td>
<td>
<ins><code>int16_t</code></ins>
</td>
</tr>

<tr>
<td>
<ins><code>atomic_uint16_t</code></ins>
</td>
<td>
<ins><code>uint16_t</code></ins>
</td>
</tr>

<tr>
<td>
<ins><code>atomic_int32_t</code></ins>
</td>
<td>
<ins><code>int32_t</code></ins>
</td>
</tr>

<tr>
<td>
<ins><code>atomic_uint32_t</code></ins>
</td>
<td>
<ins><code>uint32_t</code></ins>
</td>
</tr>

<tr>
<td>
<ins><code>atomic_int64_t</code></ins>
</td>
<td>
<ins><code>int64_t</code></ins>
</td>
</tr>

<tr>
<td>
<ins><code>atomic_uint64_t</code></ins>
</td>
<td>
<ins><code>uint64_t</code></ins>
</td>
</tr>

<tr>
<td colspan="2" align="center">
<code>&hellip;</code>
</td>
</tr>

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






</body>
</html>
