Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The volatile keyword eliminates this confusion by imposing restrictions on access and caching. According to the C99 Rationale [ISO/IEC 2003],

No caching through this lvalue: each operation in the abstract semantics must be performed (that is, no caching assumptions may be made, because the location is not guaranteed to contain any previous value). In the absence of this qualifier, the contents of the designated location may be assumed to be unchanged except for possible aliasing.

...

CERT C++ Secure Coding Standard: DCL34-CPP. Use volatile for data that cannot be cached

ISO/IEC 9899:1999 Section 6.7.3, "Type qualifiers"

ISO/IEC 9899:2011 Section 6.7.3, "Type qualifiers," and Section 7.14, "Signal handling <signal.h>"

ISO/IEC 2003 Section 6.7.3, "Type qualifiers"

...