Versions Compared

Key

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

...

Wiki Markup
The {{volatile}} keyword eliminates this confusion by imposing restrictions on access and caching. According to the C99 Rationale \[[ISO/IEC 032003|AA. Bibliography#ISO/IEC 03]\]

...

While type qualifying objects as volatile ensures that a compiler does not perform unintended reordering or optimization, it in no way guarantees synchronization between multiple threads, protects against simultaneous memory accesses, and, unless used to declare objects of type sig_atomic_t, guarantees atomicity of accesses to the object. For restrictions specific to signal handlers, see guideline rule SIG31-C. Do not access or modify shared objects in signal handlers.

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

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

...

Wiki Markup\[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] Section 6.7.3, "Type qualifiers," and Section 7.14, "Signal handling <signal.h>" \[[

ISO/IEC 2003|AA. Bibliography#ISO/IEC 03]\] Section 6.7.3, "Type qualifiers"

Bibliography

Wiki Markup

\[[Sun 2005|AA. Bibliography#Sun 05]\] [Chapter 6, "Transitioning to ISO C"|http://docs.sun.com/source/819-3688/tguide.html#pgfId-997898]

...