Name

volatile qualifier — Volatile qualifier

Synopsis

               cv-qualifier ::= const | volatile
cv-qualifier-seq ::= const | volatile | const volatile | volatile const

The volatile qualifier can be used with objects and member functions. The volatile qualifier tells the compiler to avoid certain optimizations because the object’s value can change in unexpected ways. As a function qualifier, volatile tells the compiler to treat this as a volatile pointer in the member function body.

Example

volatile sig_atomic_t interrupted = false;

See Also

const, const_cast, type, Chapter 2, Chapter 5

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.