[Issue 4419] __gshared static in class has no effect

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 20 14:37:30 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=4419


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #5 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-12-20 14:37:29 PST ---
> 1) Why is static and __gshared mutually exclusive, doesn't __gshared imply
static?

It implies the field is a property of the type, not the instance. It's *like*
static, but static == TLS, __gshared == global. I think maybe the OP thought
__gshared was a modifier you can apply to static, but it's not, __gshared can
be (and should be) used alone.

Both "static __gshared" and "__gshared static" should be rejected, because you
can't ask the compiler "make this field thread-local *and* global, and make it
a property of the type". It's either TSL or global, not both.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list