Document: N1906
Date: 2015-02-23
Author: Douglas Walls
Subject: Proposed T.C. for DR431
During the October 2014 WG14 meeting I accepted the action to come up
with a proposed TC for DR 431 to bring the wording of how
atomic_compare_exchange generic function works in line with the C++
wording to resolve the issue of how brought up by DR 431
on how atomic_compare_exchange is to work on structs.
At that meeting I brought to the attention of WG14 that the C++ wording
for atomic_compare_exchange (see 29.5p21) has been explicitly
defined to be that of bit comparison. C11 defines it as value
comparison.
7.17.7.4p2 currently reads in part:
Atomically, compares the value pointed to by object for equality with
that in expected, and if true, replaces the value pointed to by object
with desired, and if false, updates the value in expected with the value
pointed to by object.
The equivalent C++11 sentence from 29.5p21 reads:
Atomically, compares the contents of the memory pointed to by object or
by this for equality with that in expected, and if true, replaces the
contents of the memory pointed to by object or by this with that in
desired, and if false, updates the contents of the memory in expected
with the contents of the memory pointed to by object or by this.
Proposed Technical Corrigendum
7.17.7.4p2 replace the second sentence
with:
Atomically, compares the contents of
the memory pointed to by object for
equality with that in expected, and if true, replaces the contents of
the memory pointed to by object with desired, and if false, updates the
value in expected with the value pointed to by object.