4 ms·
Thanks for the leveled response! > Sure, but memory ordering is orthogonal to LL/SC vs CAS. Sure, but your original claim was that std::atomic has been design
by spacechild1 1y ago
Thanks for the leveled response!
> Sure, but memory ordering is orthogonal to LL/SC vs CAS.
Sure, but your original claim was that std::atomic has been designed with only x64 in mind. That's what I meant to argue against.
I agree that the omission of something like fetch_update() has been an oversight and I hope that it will make it into the C++ standard!
As a side note, here's what the Rust docs say about fetch_update():
> This method is not magic; it is not provided by the hardware. It is implemented in terms of AtomicUsize::compare_exchange_weak, and suffers from the same drawbacks.
https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize.html#considerations https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize...
So Rust's std::sync::atomic is equally "useless"? :)
- TuxSH 1y agoHeh, you're right, good catch: https://godbolt.org/z/3cEfbqM51 https://godbolt.org/z/3cEfbqM51 Looks like their (Rust) main motivator was readability. Whereas P3330R0 has that + performance on non-CAS hardware in mind. In any case, Rust's function could be optimized in the future, if they decide on it.