The volatile Keyword
Get a detailed introduction to the 'volatile' keyword.
We'll cover the following...
Proposal
The abstract in the proposal P1152R0 gives a short description of the changes that volatile undergoes:
“The proposed deprecation preserves the useful parts of volatile and removes the dubious / already broken ones. This paper aims at breaking at compile-time code which is today subtly broken at run time or through a compiler update.”
Before I dive into volatile
, I want to answer the crucial question: When should you use volatile
? A note from the C++ standard says that “volatile is a hint to the implementation to avoid aggressive optimization involving the object because the value of the object might be changed by ...