Say I have some object declared as const volatile
:
According to the C++ standard ($7.1.5.1/8):
[..] volatile is a hint to the implementation to avoid aggressive optimization involving the object because the value of the object might be changed by means undetectable by an implementation.[...]
However, the const
qualifier implies than the object is not subject to change, so the two qualifiers appear to conflict:
One implies the object should be treated differently because it is subject to change, and the other implies it should be treated differently because it is not subject to change.
So, why are variables allowed be be const volatile
in the first place?