[Issue 2642] ClassInfo.init contains zeroes
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 22 06:09:21 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2642
dhasenan at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|.init contains zeroes |ClassInfo.init contains
| |zeroes
------- Comment #8 from dhasenan at gmail.com 2009-02-22 08:09 -------
It wasn't clear to me that this is talking about ClassInfo.init rather than
Type.init.
Non-nullable types do nothing for this problem. Class initialization consists
of three stages:
1. allocate appropriate size
2. memcpy ClassInfo.init to allocated space
3. run constructor
With or without explicit initialization requirements, you could put that
initialization in the constructors. That is going to be slower than copying
bytes in some circumstances. Of course, if there's only a few fields to set,
since the allocator already zeroes out allocated memory, that's less work.
In any case, it will be convenient to have ClassInfo.init, for doing various
There Be Dragons things.
--
More information about the Digitalmars-d-bugs
mailing list