On Saturday, 27 May 2017 at 11:52:04 UTC, John Colvin wrote:
Nope. __gshared isn't even part of the type so it can't do that.

__gshared int a;

void main()
{
    foo(a);

But this should fail since foo doesn't take shared?

__gshared is a way of declaring a C-like global variable, but D does not - in general - support accessing it in a C-like way. My advice is to cast to shared before use, unless you're totally sure you know what other threads will be doing.

Why isn't it always typed as shared?

Reply via email to