3 ms·
In this case, the programmer cannot reasonably expect that a concurrent read produces a meaningful result. There are good reasons to use clean, abstract formal
by mike_hock 10y ago
In this case, the programmer cannot reasonably expect that a concurrent read produces a meaningful result.
There are good reasons to use clean, abstract formal logic over brutish "engineering" that results in a myriad of unmaintainable "if x, y, and z, do this, but not if also a or b, then we do that."
That said, I agree that compilers should not needlessly optimize based on undefined behavior in cases where a sensible architecture-specific behavior can be defined (but turning a "read can produce any value" into a "read can produce high 32 bits from old write and low 32 bits from new write" isn't even worth specifying).