[Issue 4378] Array Literals as Default Field Initializers Shared Across Instances.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 24 10:07:31 PDT 2010


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



--- Comment #5 from Jonathan M Davis <jmdavisProg at gmail.com> 2010-06-24 10:07:27 PDT ---
bar is a member varible _not_ a class variable and should _not_ be global. As
such, two independently constructed variables of type Foo should have bars
which referenc totally separate arrays. If bar were static, then they'd be
shared, but it's not.

Now, if the second Foo were constructed by copying the first one, then sure,
that's going to result in both bars referencing the same array, and setting an
element of one will affect the other. However, in this case, both variables of
type Foo were constructed independently, so their bars should not point to the
same array.

-- 
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