On Wednesday, 17 January 2018 at 07:53:24 UTC, Jonathan M Davis wrote:
I don't know what you're doing, and maybe __gshared is the appropriate solution for what you're trying to do, but in general, if you're not trying to bind to a C global variable, you should be using shared, and using __gshared is risking bugs precisely because it is not considered part of the type and does not prevent you from using it a thread-local context. The compiler will treat it as thread-local, risking subtle bugs that shared would catch.

- Jonathan M Davis

I was under the impression that with shared you have to either
a) atomically load it or
b) cast away shared before loading it.

As explained in https://github.com/ldc-developers/druntime/pull/114#discussion_r161472745 that would very much add boilerplate to its most frequent use case.

Reply via email to