Failure Order Derived

std::atomic<Node*> head;

Node* expected = head.load(std::memory_order_relaxed);
head.compare_exchange_strong(expected, fresh, std::memory_order_acq_rel);

The three-argument overload was used, so only the success ordering was written out and the failure ordering is derived from it. Which ordering does the failing path actually get?

A

seq_cst, because the standard promotes a derived failure order to the strongest available ordering.

B

acquire, because a failed compare-exchange performs no store, so the release half has nothing to publish and is dropped.

C

acq_rel, because the shorter overload applies the one argument to both paths.

D

relaxed, because a failure is only a load and carries no ordering at all.