On Saturday, 27 May 2017 at 16:19:06 UTC, Kagamin wrote:
On Saturday, 27 May 2017 at 10:29:05 UTC, Ola Fosheim Grøstad
wrote:
Hm, I would think that using __gshared would not be affected
by compiler improvements, since it would turn off
optimizations that assume that the variable doesn't change
between reads?
Like volatile? Volatile doesn't work.
Volatile is different. Volatile means there can be side-effects
from reads/writes, so the compiler cannot optimize out writes.
This is for hardware registers.
__gshared has purpose to behave like old good global variable
simply to provide a low level feature for a system language, if
you need something else, then use the right tool.
Doesn't make much sense to me.
If the semantics in C is that everything is typed shared then it
should also be treated as such when D interfaces with C and C
like type-semantics.