Get the latest tech news

C++: Strongly Happens Before?


Strongly Happens Before? It started innocently enough. I just wanted to brush up on C++ memory orderings. It’s been a while since I last stared into the abyss of std::atomic, so I figured, why not revisit some good ol’ std::memory_order mayhem?

A is a modification, and B reads the value stored by A We’ll refer to this as the “read-from” relationship in the diagrams going forward, just to keep things visually clearer. According to P0668R5, enforcing a stricter rule would introduce a significant performance penalty on acquire/release synchronization, essentially defeating the purpose of memory_order_acquire and memory_order_release. This confirms that the execution we previously marked as invalid under the “happens-before” interpretation is in fact valid on Power.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of C++

C++

Related news:

News photo

Writing Speed-of-Light Flash Attention for 5090 in CUDA C++

News photo

C++: "model of the hardware" vs. "model of the compiler" (2018)

News photo

C++: Zero-cost static initialization