Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P0528R3 The curious case of padding bits, featuring atomic compare-and-exchange #2154

Merged
merged 1 commit into from Jun 19, 2018

Conversation

tkoeppe
Copy link
Contributor

@tkoeppe tkoeppe commented Jun 11, 2018

Added a cross-reference for "padding bits".

Fixes #2121.

@jensmaurer jensmaurer added this to the post-2018-06 milestone Jun 11, 2018
operations may result in failed comparisons for values that compare equal with
\tcode{operator==} if the underlying type has padding bits, trap bits, or alternate
\begin{note}
Under cases where \tcode{memcpy} and \tcode{memcmp} semantics of the compare-and-exchange
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "the" after "where"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// Padding here.
unsigned biff = 0xC0DEFEFE;
};
atomic<padded> pad = ATOMIC_VAR_INIT({});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop the Cism of ATOMIC_VAR_INIT here and use = padded{} or ({})?

(I've also asked on LWG whether it's intended that atomic<padded> pad = {}; should work. But regardless of whether it should, that is not guaranteed today.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need ATOMIC_VAR_INIT until Nico's fix P0883R1 makes it in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving as is then? We can change it later if that's appropriate.

Copy link
Contributor

@jfbastien jfbastien Jun 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think you should leave it as-is and editorially remove uses of ATOMIC_VAR_INIT when P0833R1 is voted in. This was discussed in CWG and people decided to keep ATOMIC_VAR_INIT in my paper for now. Of course the example isn't normative, so 🤷‍♂️

Copy link
Member

@zygoloid zygoloid Jun 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need P0833R1. That permits

atomic<padded> pad = {};

but either of the forms I suggested work fine without P0833, because they use the atomic(T) constructor, not the default constructor.

Still... if CWG wants the ATOMIC_VAR_INIT, then let's leave it alone.

double celestia = 0.;
short luna; // padded
};
atomic<pony> princesses = ATOMIC_VAR_INIT({});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

@tkoeppe
Copy link
Contributor Author

tkoeppe commented Jun 14, 2018

Sorry, I force-pushed this one rather than making a new commit, because I had already rebased on the new master (even though for this branch that wasn't even necessary). I'll try to preserve commits in the future.

…d-exchange

Added a cross-reference for "padding bits".
@zygoloid zygoloid merged commit 6844810 into master Jun 19, 2018
@jensmaurer jensmaurer deleted the motions-2018-06-cwg-9 branch October 19, 2019 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants