What is the difference between load/store relaxed atomic and normal variable?
问题 As I see from a test-case: https://godbolt.org/z/K477q1 The generated assembly load/store atomic relaxed is the same as the normal variable: ldr and str So, is there any difference between relaxed atomic and normal variable? 回答1: The difference is that a normal load/store is not guaranteed to be tear-free, whereas a relaxed atomic read/write is. Also, the atomic guarantees that the compiler doesn't rearrange or optimise-out memory accesses in a similar fashion to what volatile guarantees.