4 ms·
> ... std::atomic<bool>. This tells the compiler not to elide reads and writes of this variable, ... If I'm not mistaken, this is not true. The compiler is sti
by alvarelle 6y ago
> ... std::atomic<bool>. This tells the compiler not to elide reads and writes of this variable, ...
If I'm not mistaken, this is not true. The compiler is still allowed to elide reads and writes on atomic variables. (For example merge two consecutive writes, or remove unused reads)
- gpderetta 6y agoCorrect. See "N4455 No Sane Compiler Would Optimize Atomics" [1]. The first sentence of that paper is (spoiler allert) a laconic "false". [1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4455.html http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n445...
- brucedawson 6y agoUpdated. Thanks for the correction.