Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC++relaxed memory semanticsSingle-choice MCQ

Under the C++ memory model, what does 'out-of-thin-air' (OOTA) prevention require for relaxed atomics, and why is it more of a specification problem than a real hardware behavior?

// x, y atomic<int> = 0 // T1: r1 = x.load(relaxed); y.store(r1, relaxed); // T2: r2 = y.load(relaxed); x.store(r2, relaxed); // Is r1 == r2 == 42 (a value never written elsewhere) allowed?