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

[atomics] reorder members of atomic and atomic_ref to a more meaningful and conventional order #3172

Closed
zygoloid opened this issue Aug 13, 2019 · 1 comment · Fixed by #3264
Assignees

Comments

@zygoloid
Copy link
Member

The members of atomic and its specializations are currently presented in this order:

  • typedefs, traits, constants
  • lock_free stuff
  • stores and loads
  • compare exchange and fetch_*
  • wait and notify
  • constructors
  • assignment operators
  • compound assignment operators and inc/dec

That's far from our normal order, separates similar operations (fetch_* and compound assignment), and groups together completely different operations (simple assignment and compound assignment).

This order would seem substantially better:

  • typedefs, traits, constants, and lock_free stuff
  • constructors
  • stores, loads, and assignment operators
  • compare exchange and fetch_*, compound assignment operators, and inc/dec
  • wait and notify

atomic_ref is closer to this, but also has surprising ordering (its simple assignment is before its constructors, and its is_lock_free is not grouped with is_always_lock_free).

@opensdh
Copy link
Contributor

opensdh commented Aug 14, 2019

I like having assignment near compound assignment even if their semantics differ significantly because of the obvious conceptual similarity and the lesser information returned. That's not an objection to your proposed order, since it can be made to preserve that property by putting compound assignment operators first in their bullet.

@jensmaurer jensmaurer changed the title reorder members of atomic and atomic_ref to a more meaningful and conventional order [atomics] reorder members of atomic and atomic_ref to a more meaningful and conventional order Sep 24, 2019
@jensmaurer jensmaurer self-assigned this Oct 3, 2019
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 a pull request may close this issue.

3 participants