This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.
Section: 33.5.8.2 [atomics.types.operations] Status: NAD Submitter: INCITS Opened: 2010-08-25 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [atomics.types.operations].
View all issues with NAD status.
Discussion:
Addresses US-172
As of 33.5.8.2 [atomics.types.operations] p. 9, 13, 17, 20:
The order specifications are incomplete because the non-_explicit
functions do not have such parameters.
Add a new sentence: "If the program does not specify an order, it shall be
memory_order_seq_cst
." Or perhaps: "The non-_explicit
non-member functions shall affect memory as though they were _explicit with
memory_order_seq_cst
."
[ 2010 Batavia ]
The Concurrency subgroup reviewed this, and deemed it NAD according to 33.5.8.2 [atomics.types.operations] paragraph 2, bullet 4.
Rationale:
The working paper is correct as written.
Proposed resolution:
void atomic_store(volatile A* object, C desired); void atomic_store(A* object, C desired); void atomic_store_explicit(volatile A *object, C desired, memory_order order); void atomic_store_explicit(A* object, C desired, memory_order order); void A::store(C desired, memory_order order = memory_order_seq_cst) volatile; void A::store(C desired, memory_order order = memory_order_seq_cst);8 Requires: The order argument shall not be
9 Effects: Atomically replaces the value pointed to bymemory_order_consume
,memory_order_acquire
, normemory_order_acq_rel
.object
or by this with the value ofdesired
. Memory is affected according to the value oforder
. If the program does not specify an order, it shall bememory_order_seq_cst
.
C atomic_load(const volatile A* object); C atomic_load(const A* object); C atomic_load_explicit(const volatile A* object, memory_order); C atomic_load_explicit(const A* object, memory_order); C A::load(memory_order order = memory_order_seq_cst) const volatile; C A::load(memory_order order = memory_order_seq_cst) const;12 Requires: The order argument shall not be
13 Effects: Memory is affected according to the value ofmemory_order_release
normemory_order_acq_rel
.order
. If the program does not specify an order, it shall bememory_order_seq_cst
. 14 Returns: Atomically returns the value pointed to byobject
or bythis
.
C atomic_exchange(volatile A* object, C desired); C atomic_exchange(A* object, C desired); C atomic_exchange_explicit(volatile A* object, C desired, memory_order); C atomic_exchange_explicit(A* object, C desired, memory_order); C A::exchange(C desired, memory_order order = memory_order_seq_cst) volatile; C A::exchange(C desired, memory_order order = memory_order_seq_cst);17 Effects: Atomically replaces the value pointed to by
18 Returns: Atomically returns the value pointed to byobject
or bythis
withdesired
. Memory is affected according to the value oforder
. These operations are atomic read-modify-write operations (1.10). If the program does not specify an order, it shall bememory_order_seq_cst
.object
or bythis
immediately before the effects.
bool atomic_compare_exchange_weak(volatile A* object, C * expected, C desired); bool atomic_compare_exchange_weak(A* object, C * expected, C desired); bool atomic_compare_exchange_strong(volatile A* object, C * expected, C desired); bool atomic_compare_exchange_strong(A* object, C * expected, C desired); bool atomic_compare_exchange_weak_explicit(volatile A* object, C * expected, C desired, memory_order success, memory_order failure); bool atomic_compare_exchange_weak_explicit(A* object, C * expected, C desired, memory_order success, memory_order failure); bool atomic_compare_exchange_strong_explicit(volatile A* object, C * expected, C desired, memory_order success, memory_order failure); bool atomic_compare_exchange_strong_explicit(A* object, C * expected, C desired, memory_order success, memory_order failure); bool A::compare_exchange_weak(C & expected, C desired, memory_order success, memory_order failure) volatile; bool A::compare_exchange_weak(C & expected, C desired, memory_order success, memory_order failure); bool A::compare_exchange_strong(C & expected, C desired, memory_order success, memory_order failure) volatile; bool A::compare_exchange_strong(C & expected, C desired, memory_order success, memory_order failure); bool A::compare_exchange_weak(C & expected, C desired, memory_order order = memory_order_seq_cst) volatile; bool A::compare_exchange_weak(C & expected, C desired, memory_order order = memory_order_seq_cst); bool A::compare_exchange_strong(C & expected, C desired, memory_order order = memory_order_seq_cst) volatile; bool A::compare_exchange_strong(C & expected, C desired, memory_order order = memory_order_seq_cst);19 Requires: The
20 Effects: Atomically, compares the contents of the memory pointed to byfailure
argument shall not bememory_order_release
normemory_order_acq_rel
. Thefailure
argument shall be no stronger than the success argument.object
or bythis
for equality with that inexpected
, and if true, replaces the contents of the memory pointed to byobject
or bythis
with that indesired
, and if false, updates the contents of the memory in expected with the contents of the memory pointed to byobject
or bythis
. Further, if the comparison is true, memory is affected according to the value ofsuccess
, and if the comparison is false, memory is affected according to the value offailure
. When only onememory_order
argument is supplied, the value ofsuccess
isorder
, and the value offailure
isorder
except that a value ofmemory_order_acq_rel
shall be replaced by the valuememory_order_acquire
and a value ofmemory_order_release
shall be replaced by the valuememory_order_relaxed
. If the program does not specify an order, it shall bememory_order_seq_cst
. If the operation returnstrue
, these operations are atomic read-modify-write operations (1.10). Otherwise, these operations are atomic load operations. [..]