Description
Currently compare_exchange
requires the failure ordering to "be equivalent to
or weaker than a success ordering". On the other hand C11/C++11 requires only
that "failure shall be no stronger than the success", which arguably means that
one can write e.g. compare_exchange(..., Release, Acquire)
in C/C++ but not in Rust.
Arguably, because neither C11 standard nor C++11 standard defines what it means
for an ordering to be stronger from another. When the issue was raised in
LWG2445, the proposed and accepted resolution was to lift those restrictions
altogether, leaving only requirement that "the failure argument shall not be
memory_order_release
nor memory_order_acq_rel
".
It would be beneficial to remove success/failure ordering restrictions for
reasons described in C++ proposal P0418r2.
EDIT: Restrictions were lifted in clang & LLVM: