Ways to break your systems code using volatile

Ways to break your systems code using volatile

The behavior of any given C implementation (a compiler plus target machine) must produce the same side effects as the abstract machine, but otherwise the standard mandates very little correspondence between the abstract machine and computation that actually happens on the target platform. The C standard gives us just a few ways to establish a connection between the abstract and actual machines:

Most C implementations offer additional mechanisms, such as inline assembly and extra library functions not mandated by the standard. The way the volatile connects the abstract and real semantics is this:

Historically, the connection between the abstract and actual machines was established mainly through accident: compilers weren’t good enough at optimizing to create an important semantic gap.

Source: blog.regehr.org