www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5338] New: __gshared on class member variable implies static?

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5338

           Summary: __gshared on class member variable implies static?
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: braddr puremagic.com



---
module buggshared;

class A
{
    shared static this()
    {  
        supported["foo"] = "bar";
    }

    __gshared string[string] supported;
}

This builds, which means that__gshared in a class scope implies static?  That
doesn't seem like a good idea.  I didn't find where that's documented either.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 10 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5338


Trass3r <mrmocool gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrmocool gmx.de



Makes sense to me.
How can a class member be __gshared without being static?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 23 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5338




---
Static means there's a single instance.  Shared simply means more than one
thread has visibility to it.  Two very different properties.  Neither implies
the other.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 23 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5338


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |WORKSFORME



13:40:39 PST ---
From attributes.html:

"__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."

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