how does 'shared' affect member variables?
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat May 9 13:21:53 PDT 2015
On Saturday, 9 May 2015 at 19:59:58 UTC, tcak wrote:
> Stupidly, shared variables' value cannot be increased/decreased
> directly. Compiler says it is deprecated, and tells me to use
> core.atomic.atomicop. You will see this as well.
How's that stupid? Sounds like the compiler is doing its job
guarding you from races.
> Hey compiler! I know 100% that no other thing will be touching
> this variable.
Informing the compiler about this is done by casting shared away.
More information about the Digitalmars-d-learn
mailing list