3 ms·
> not all systems have strong memory ordering Atomics require you to explicitly specify a memory ordering for every operation, so the system's memory ordering
by CodesInChaos 2y ago
> not all systems have strong memory ordering
Atomics require you to explicitly specify a memory ordering for every operation, so the system's memory ordering doesn't really matter. It's still possible to get it wrong, but a lot easier than in (traditional) C.
- reitzensteinm 2y agoIt's still possible to incorrectly use relaxed operations, and have your algorithm only incidentally work because the compiler hasn't reordered them and you're on a CPU with a stronger memory model. But yes, it's an order of magnitude easier to get portability right using the C++/Rust memory model than what came before.