https://godbolt.org/z/4h893P7hG
({READ,WRITE}_ONCE() only lets the compiler reorder the accesses if they happen in the same C statement).
I think C++ doesn't have an equivalent because it just doesn't make sense as a primitive in very many environments.
reply
https://godbolt.org/z/4h893P7hG