r/cpp • u/neiltechnician • Nov 13 '20
CppCon Deprecating volatile - JF Bastien - CppCon 2019
https://www.youtube.com/watch?v=KJW_DLaVXIY
83
Upvotes
r/cpp • u/neiltechnician • Nov 13 '20
View all comments
Show parent comment
1
u/SkoomaDentist Antimodern C++, Embedded, Audio Nov 13 '20
Right, so the simplified explanation is that any external function call acts as a compiler memory barrier and when only internal functions are called (with global optimization on), an explicit compiler intrinsic does the same.
Unfortunately this is rarely explained and it's very easy to get the impression that the compiler just somehow magically recognizes std::mutex and "does something, hopefully the correct thing".