Does volatile prevent introduced reads or writes?
问题 In C#, volatile keyword ensures that reads and writes have acquire and release semantics, respectively. However, does it say anything about introduced reads or writes? For instance: volatile Thing something; volatile int aNumber; void Method() { // Are these lines... var local = something; if (local != null) local.DoThings(); // ...guaranteed not to be transformed into these by compiler, jitter or processor? if (something != null) something.DoThings(); // <-- Second read! // Are these lines..