What is the volatile modifier?
What is the volatile modifier? ——————————— The volatile modifier is like the const modifier. The term used in the C++ standard is qualifier rather than modifier. Const and volatile are qualifications that can be applied to types. In fact where you can use const you can use volatile so a type can be neither const nor volatile qualified, const qualified, volatile qualified or const volatile qualified. The language is so regular in this respect that the standard uses the terms like ‘cv-qualifiers’ and ‘cv-qualified’, cv being short hand for const-volatile. What is the difference between a volatile and non volatile variable? ———————————————————————– A volatile qualification on a type is a hint to the compiler that objects (variables) of that type are likely to change or be read outside of the control of the program under compilation, hence the compiler cannot assume anything with regard to optimisation. Where should I use