News for hackers. Stuff that matters.
Re:What's up with this new memory_order_consume memory order? by tialaramex on Wednesday May 24, 2023 @11:35AM (#36059575)
All the (C++) defaults are wrong, of course.

But in this case I believe the choice to have a default was itself the error. I have been persuaded that either you know which Ordering you need, and thus you should specify what you meant - or else you should not be using these APIs at all. If you aren't confident of the correct Ordering, you are not in fact confident your algorithm is correct, so don't do it.

Re:What's up with this new memory_order_consume memory order? by gpderetta on Wednesday May 24, 2023 @11:52AM (#36059820)
You are not wrong; still an std::atomic variant that defaulted to mo_release on assignment, mo_acquire on load and mo_aq_rel on RMW would have covered 99% of my use cases.

Then again, I usually target x86 where these defaults are optimal, in other architectures relaxing RMWs further has benefits.