overly strict semantics
overly strict semantics
Posted Jan 9, 2026 17:42 UTC (Fri) by bertschingert (subscriber, #160729)Parent article: READ_ONCE(), WRITE_ONCE(), but not for Rust
I wasn't around when they were implemented, so I'm speculating here, but I get the sense that READ/WRITE_ONCE() were implemented as a volatile cast not because volatility gives the optimal or desired semantics in most situations, but because that was the best tool available prior to the C11 atomics model.
While it may be prohibitively difficult, it does seem like changing the C side to use relaxed atomics (when correct) would be the right thing to do. But I don't really know how many uses actually require the additional "volatility" guarantee provided by READ/WRITE_ONCE().
