[Issue 4419] __gshared static in class has no effect
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Aug 24 07:37:54 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=4419
Puneet Goel <puneet at coverify.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |puneet at coverify.org
--- Comment #7 from Puneet Goel <puneet at coverify.org> 2013-08-24 07:37:52 PDT ---
(In reply to comment #5)
> > 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.
But I see both "static __gshared" and "__gshared static" used in phobos as well
as druntime. Many of this usages I believe should be buggy!
See....
$ find . -type f -exec grep -nH -e "__gshared static" {} +
./phobos/std/parallelism.d:1039: __gshared static size_t nextInstanceIndex =
1;
./phobos/std/parallelism.d:3271: __gshared static TaskPool pool;
./druntime/src/core/thread.d:3862: __gshared static fp_t
finalHandler = null;
--
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