A compiler cannot eliminate or reorder reads/writes to a volatile-qualified variables.
volatile
But what about the cases where other variables are present, which
Volatile is not a memory fence. Assignments to B and C in snippet #2 can be eliminated or performed whenever. Why would you want the declarations in #2 to cause the behavior of #1?