immutable, static, __gshared, TLS, and compile time allocation

Manu turkeyman at gmail.com
Fri Apr 20 17:22:21 PDT 2012


On 21 April 2012 03:05, Michel Fortin <michel.fortin at michelf.com> wrote:

> If you're trying to make a C-like global, write this:
>
>        static __gshared int x;
>

dlang.org seems to disagree:
"__gshared may also be applied to member variables and local variables. In
these cases, *__gshared is equivalent to static*, except that the variable
is shared by all threads rather than being thread local."
Suggests to me that you are not required to state both.

So which is correct?
It appears most people are confused about this. I'm thinking more and more
it's worth addressing that confusion with some warnings/errors.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120421/2b4c616f/attachment-0001.html>


More information about the Digitalmars-d mailing list