[dmd-internals] Regarding deprecation of volatile statements

Alex Rønne Petersen xtzgzorex at gmail.com
Mon Jul 23 14:28:05 PDT 2012


Hi,

I'm a bit confused.

First of all: From what I understand, volatile is merely a compiler
reordering fence. It has nothing to do with atomicity, nor
synchronization. Is this correct?

Assuming my understanding is correct: Why does DMD suggest using
synchronized to replace volatile statements? It doesn't even remotely
do the same thing, is much heavier, calls into the runtime, etc.

And further: How are people *really* supposed to prevent compiler
reordering in modern D2 programs (without using atomics; they are
expensive and wasteful for this)?

Regards,
Alex


More information about the dmd-internals mailing list