[Issue 1493] Problem with dynamic array
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 11 03:23:54 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1493
default_357-line at yahoo.de changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |default_357-line at yahoo.de
------- Comment #1 from default_357-line at yahoo.de 2007-09-11 05:23 -------
This isn't a bug.
An array, behind the scenes, is nothing but a pointer and a length.
So the dynamic array in your class gets initialized with a specific pointer and
length, which is the same for all instances because the _literal_ is the same.
The correct thing to do here is initialize the dynamic array in the
constructor, for example, by dup-ing it :)
--downs
--
More information about the Digitalmars-d-bugs
mailing list