|
|
|
|
|
by likeliv
2437 days ago
|
|
I know rust is not C or C++, but we are not programming in x86 assembly, but for the language "abstract machine". And if the compiler infer that this memory location is not used by other threads because we don't use an atomic operation, it can perform optimizations that could result in subtle bugs. That's what undefined behaviour is. Although in this case, I guess this is probably fine since the non-atomic read can't race with a write. |
|