What    |Removed                     |Added
                 CC|                            |

--- Comment #4 from 2010-06-24 05:32:46 PDT ---
How is this supposed to work "correctly"? Hidden allocation of an array on the
heap every time a struct of that type is "constructed"? Disallow initializing
non-immutable, non-static array members?

This is not a bug, it's just D _works_. If you assign an array to a global
variable, of course it's shared by everyone. Dynamic arrays are reference
types. The "variable" being a struct initializer doesn't change this.

I think this really should be marked as INVALID.

(I'm sure it's somewhat confusing for programmers coming from C++ or Java.
Especially in Java, the array would be reconstructed every time the constructor
is called. Stuff like this _never_ happens in D: structs are always initialized
by what boils down to a memcpy.)

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to