[atomics.types.operations] Possibly unintended example
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Note 8 of [atomics.types.operations] and read the surrounding atomic operations wording. Check whether the example demonstrates the intended padding or indeterminate-value behavior, then revise the example if needed; the issue is resolved when the note clearly serves its intended purpose.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100