5 ms·
Is "standard practice" nowadays to use C++11 memory orderings or barriers, instead of platform-specific macros?.I know that's the case in the Rust world.
by nyanpasu64 4y ago
Is "standard practice" nowadays to use C++11 memory orderings or barriers, instead of platform-specific macros?.I know that's the case in the Rust world.
- anyfoo 4y agoYes. They are much, much more likely to do the right thing than what one can cook up themselves. And if used correctly, work consistently and performantly across platforms (e.g. in theory at least, release and acquire barriers could be just a full stop-the-world memory barrier on one platform, and something more granular on another).
- pajko 4y agoC11 also has them: https://en.cppreference.com/w/c/atomic/memory_order https://en.cppreference.com/w/c/atomic/memory_order