[dmd-internals] Regarding deprecation of volatile statements

David Nadlinger code at klickverbot.at
Tue Jul 24 16:32:01 PDT 2012


On Wed, Jul 25, 2012 at 1:20 AM, Walter Bright <walter at digitalmars.com> wrote:
> However, I do understand that the D spec does allow a compiler to do this.

As far as I know, LLVM (and thus LDC), already does this all over the
place today. LLVM's definition of volatile (at the IR level), by the
way, is: »The optimizers must not change the number of volatile
operations or change their order of execution relative to other
volatile operations. The optimizers may change the order of volatile
operations relative to non-volatile operations.«

> Even though shared is not implemented at the low level, I suggest using it
> anyway as it currently does work (with or without shared).

The main problem with shared is that it isn't clear what it is
supposed to do once it's implemented – we don't even have a memory
model to _express_ this yet. x86 might be fairly docile in that
regard, other architectures are not.

David


More information about the dmd-internals mailing list