The example in [atomics.types.operations] Note 8 currently reads:
union pony {
double celestia = 0.;
short luna; // padded
};
atomic<pony> princesses = {};
bool party(pony desired) {
pony expected;
return princesses.compare_exchange_strong(expected, desired);
}
In common implementations, pony have the same size as double and a default- or value-initialized pony doesn't have any bit with indeterminate value. So it's questionable to me whether this example serves its purpose. Would it make more sense to initialize the short member instead?
The example in [atomics.types.operations] Note 8 currently reads:
In common implementations,
ponyhave the same size asdoubleand a default- or value-initializedponydoesn't have any bit with indeterminate value. So it's questionable to me whether this example serves its purpose. Would it make more sense to initialize theshortmember instead?