Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: minor edits

An object that has volatile-qualified type may be modified in ways unknown to the implementation or have other unknown side effects. It is possible to reference Referencing a volatile object by using a nonvolatile value , but the resulting behavior is undefinedresults in undefined behavior. The C Standard, section subclause 6.7.3 [ISO/IEC 9899:2011], states:

...

The assignment ipp = &ip is unsafe because it would allow the valid code that follows to reference the value of the volatile object i through the non-volatile-qualified reference ip. In this example, the compiler may optimize out the entire if block because it is not possible that i != 0 must be false if i is not volatile.

Implementation Details

...