<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 1461: Rename all ATOMIC_* macros as STD_ATOMIC_*</title>
<meta property="og:title" content="Issue 1461: Rename all ATOMIC_* macros as STD_ATOMIC_*">
<meta property="og:description" content="C++ library issue. Status: NAD">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue1461.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#NAD">NAD</a> status.</em></p>
<h3 id="1461"><a href="lwg-closed.html#1461">1461</a>. Rename all <code>ATOMIC_*</code> macros as <code>STD_ATOMIC_*</code></h3>
<p><b>Section:</b> 32.5 <a href="https://wg21.link/atomics">[atomics]</a> <b>Status:</b> <a href="lwg-active.html#NAD">NAD</a>
 <b>Submitter:</b> Canada <b>Opened:</b> 2010-08-25 <b>Last modified:</b> 2016-01-28</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all other</b> <a href="lwg-index.html#atomics">issues</a> in [atomics].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#NAD">NAD</a> status.</p>
<p><b>Discussion:</b></p>
<p><b>Addresses CA-1</b></p>
<p>
All <code>ATOMIC_</code>... macros should be prefixed with <code>STD_</code> as
in <code>STD_ATOMIC_</code>... to indicate they are <code>STD</code> macros as
other standard macros. The rationale that they all seem too long seems weak.
</p>

<p><i>[2011-03-06: Daniel adapts suggested wording to N3242 and comments]</i></p>


<p>I suggest to declare this issue as NAD. Reason for this suggestion is, that
C1x is currently going to suggest exactly the same macros as additions to
header <code>&lt;stdatomic.h&gt;</code>, therefore C++0x should not define a
whole new set. I'm making this suggestion with the understanding that
C1x is intending to keep in sync in this regard. For example, the most
<a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf">recent 
draft of C1x</a> does contain the macro <code>ATOMIC_ADDRESS_LOCK_FREE</code>
which has recently been removed from the C++ working draft.</p>

<p><i>[2011-03-24]</i></p>

<p><b>Rationale:</b></p><p>
C is not going to change the name of these macros, and it is
important they have the same name for compatibility
</p>



<p id="res-1461"><b>Proposed resolution:</b></p>
<ol>
<li><p>Change sub-clause 32.5.2 <a href="https://wg21.link/atomics.syn">[atomics.syn]</a> as indicated:</p>
<blockquote><pre>
[..]
// <em>[atomics.lockfree], lock-free property</em>
#define <ins>STD_</ins>ATOMIC_CHAR_LOCK_FREE <em>unspecified</em>
#define <ins>STD_</ins>ATOMIC_CHAR16_T_LOCK_FREE <em>unspecified</em>
#define <ins>STD_</ins>ATOMIC_CHAR32_T_LOCK_FREE <em>unspecified</em>
#define <ins>STD_</ins>ATOMIC_WCHAR_T_LOCK_FREE <em>unspecified</em>
#define <ins>STD_</ins>ATOMIC_SHORT_LOCK_FREE <em>unspecified</em>
#define <ins>STD_</ins>ATOMIC_INT_LOCK_FREE <em>unspecified</em>
#define <ins>STD_</ins>ATOMIC_LONG_LOCK_FREE <em>unspecified</em>
#define <ins>STD_</ins>ATOMIC_LLONG_LOCK_FREE <em>unspecified</em>

// <em>[atomics.types.operations.req], operations on atomic types</em>
#define <ins>STD_</ins>ATOMIC_VAR_INIT(value) <em>see below</em>
[..]
</pre></blockquote>
</li>
<li>
<p>Change 32.5.5 <a href="https://wg21.link/atomics.lockfree">[atomics.lockfree]</a> p. 1 as indicated:</p>
<blockquote><pre>
#define <ins>STD_</ins>ATOMIC_CHAR_LOCK_FREE <em>implementation-defined</em>
#define <ins>STD_</ins>ATOMIC_CHAR16_T_LOCK_FREE <em>implementation-defined</em>
#define <ins>STD_</ins>ATOMIC_CHAR32_T_LOCK_FREE <em>implementation-defined</em>
#define <ins>STD_</ins>ATOMIC_WCHAR_T_LOCK_FREE <em>implementation-defined</em>
#define <ins>STD_</ins>ATOMIC_SHORT_LOCK_FREE <em>implementation-defined</em>
#define <ins>STD_</ins>ATOMIC_INT_LOCK_FREE <em>implementation-defined</em>
#define <ins>STD_</ins>ATOMIC_LONG_LOCK_FREE <em>implementation-defined</em>
#define <ins>STD_</ins>ATOMIC_LLONG_LOCK_FREE <em>implementation-defined</em>
</pre><blockquote>
<p>
1 The <code><ins>STD_</ins>ATOMIC_..._LOCK_FREE</code> macros indicate the lock-free property of the corresponding atomic types, [..]
</p></blockquote></blockquote>
</li>
<li>
<p>Change 99 [atomics.types.operations.req] p. 6 as indicated:</p>
<blockquote><pre>
#define <ins>STD_</ins>ATOMIC_VAR_INIT(value) <em>see below</em>
</pre><blockquote><p>
5 <em>Remarks</em>: The macro expands to a token sequence suitable for constant initialization 
an atomic variable of static storage duration of a type that is initialization-compatible
with <i>value</i>. [ <i>Note</i>: This operation may need to initialize locks. &mdash; <i>end note</i> ] 
Concurrent access to the variable being initialized, even via an atomic operation, constitutes 
a data race. [ <em>Example:</em>
</p><blockquote><pre>
atomic&lt;int&gt; v = <ins>STD_</ins>ATOMIC_VAR_INIT(5);
</pre></blockquote>
<p>&mdash; <em>end example</em> ]</p>
</blockquote></blockquote>
</li>
<li>
<p>Change 32.5.10 <a href="https://wg21.link/atomics.flag">[atomics.flag]</a> p. 1+4 as indicated:</p>
<blockquote><pre>
namespace std {
  [..]
  #define <ins>STD_</ins>ATOMIC_FLAG_INIT <em>see below</em>
}
</pre><blockquote><p>
[..]
4 The macro <code><ins>STD_</ins>ATOMIC_FLAG_INIT</code> shall be defined in such a way that it can be used to initialize an object of
type <code>atomic_flag</code> to the clear state. For a static-duration object, that initialization shall be static. It is
unspecified whether an unitialized <code>atomic_flag</code> object has an initial state of set or clear. [ <em>Example:</em>
</p><blockquote><pre>
atomic_flag guard = <ins>STD_</ins>ATOMIC_FLAG_INIT;
</pre></blockquote>
<p>&mdash; <em>end example</em> ]</p>
</blockquote></blockquote>
</li>
</ol>





</body>
</html>
