[Issue 2642] ClassInfo.init contains zeroes
http://d.puremagic.com/issues/show_bug.cgi?id=2642 Walter Bright changed: What|Removed |Added Keywords|spec| --- Comment #12 from Walter Bright 2012-01-23 00:13:57 PST --- Not a spec issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2642] ClassInfo.init contains zeroes
http://d.puremagic.com/issues/show_bug.cgi?id=2642 --- Comment #11 from Sobirari Muhomori 2009-07-09 03:13:28 PDT --- oops... *fix there's no interface fixups in the object, only vptrs. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2642] ClassInfo.init contains zeroes
http://d.puremagic.com/issues/show_bug.cgi?id=2642 --- Comment #10 from Sobirari Muhomori 2009-07-09 02:55:33 PDT --- > > With or without explicit initialization requirements, you could put that > > initialization in the constructors. > .init can't be moved to constructor, because you won't be able to set vptr > correctly. Though setting of main vptr can be done in user code and other fields initialization can be moved to constructor (including interface fixups). Though this hardly makes difference in the case of inlining. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2642] ClassInfo.init contains zeroes
http://d.puremagic.com/issues/show_bug.cgi?id=2642 --- Comment #9 from Sobirari Muhomori 2009-07-09 02:47:55 PDT --- > With or without explicit initialization requirements, you could put that > initialization in the constructors. .init can't be moved to constructor, because you won't be able to set vptr correctly. Possible solution is to generate .init as a static function and inline it (or not) in the user code after call to new. Then call constructor. And trusting malloc to zero memory can be a good optimization. And I don't think .init for primitive types is copied as an array of bytes. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2642] ClassInfo.init contains zeroes
http://d.puremagic.com/issues/show_bug.cgi?id=2642 dhase...@gmail.com changed: What|Removed |Added Summary|.init contains zeroes |ClassInfo.init contains ||zeroes --- Comment #8 from dhase...@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. --