I hadn’t heard that the C/C++ ’11 standards added memory models and primitives.

I hadn’t heard that the C/C++ ’11 standards added memory models and primitives.

Example: “atomic foo, bar; foo.store(1); bar.store(2);” guarantees that foo will be written to memory before bar and they will not be reordered, unlike “int foo, bar; foo = 1; bar = 2;”

There’s also mutexes and other utilities that are standardized (instead of just using a thread or OS library).

Originally shared by Robert Love

My answer on Quora to “How are the threading and memory models different in C++ as compared to C?”

https://www.quora.com/C++-programming-language/How-are-the-threading-and-memory-models-different-in-C++-as-compared-to-C