This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Dup status.

### 1475. weak compare-and-exchange confusion II

Section: 33.5.8.2 [atomics.types.operations] Status: Dup Submitter: Switzerland Opened: 2010-08-25 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [atomics.types.operations].

View all issues with Dup status.

Duplicate of: 1474

Discussion:

Addresses CH-23

33.5.8.2 [atomics.types.operations] p. 23: The first sentence has non-English syntax.

[ Resolution proposed in ballot comment: ]

Change to "The weak compare-and-exchange operations may fail spuriously, that is, return false while leaving the contents of memory pointed to by expected unchanged."

[ Daniel translates NB comment in a proposed resolution ]

Change 33.5.8.2 [atomics.types.operations] p. 23 as indicated:

> 23 Remark: The weak compare-and-exchange operations may fail spuriously, that is, return false while leaving the contents of memory pointed to by `expected` before the operation is the same that same as that of the `object` and the same as that of `expected` after the operation The weak compare-and-exchange operations may fail spuriously, that is, return false while leaving the contents of memory pointed to by `expected` unchanged.. [ Note: This spurious failure enables implementation of compare-and-exchange on a broader class of machines, e.g., loadlocked store-conditional machines. A consequence of spurious failure is that nearly all uses of weak compare-and-exchange will be in a loop.

> When a compare-and-exchange is in a loop, the weak version will yield better performance on some platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the strong one is preferable. — end note ]

[ See 1474 for the proposed resolution ]

Proposed resolution: