Section: 32 [atomics] Status: Resolved Submitter: Herb Sutter Opened: 2008-10-17 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [atomics].
View all issues with Resolved status.
Right now, C++0x doesn't have atomic<float>. We're thinking of adding the words to support it for TR2 (note: that would be slightly post-C++0x). If we need it, we could probably add the words.
Proposed resolutions: Using atomic<FP>::compare_exchange (weak or strong) should be either:
I propose Option 1 for C++0x for expediency. If someone wants to argue for Option 2, they need to say what exactly they want compare_exchange to mean in this case (IIRC, C++0x doesn't even assume IEEE 754).
[ Summit: ]
Move to open. Blocked until concepts for atomics are addressed.
[ Post Summit Anthony adds: ]
Recommend NAD. C++0x does have std::atomic<float>, and both compare_exchange_weak and compare_exchange_strong are well-defined in this case. Maybe change the note in 32.6.1 [atomics.types.operations] paragraph 20 to:
[Note: The effect of the compare-and-exchange operations isif (!memcmp(object,expected,sizeof(*object))) *object = desired; else *expected = *object;
This may result in failed comparisons for values that compare equal if the underlying type has padding bits or alternate representations of the same value. -- end note]
[ 2009-10 Santa Cruz: ]
NAD Editorial. Addressed by N2992.
Change the note in 32.6.1 [atomics.types.operations] paragraph 20 to:
[Note: The effect of the compare-and-exchange operations isif (
*object == *expected) *object = desired; else *expected = *object;
-- end note]