February 01, 2011 [Issue 5058] invariant() should not be called before opAssign() | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=5058 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- OS/Version|Linux |All --- Comment #10 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-01-31 17:44:55 PST --- I believe that bug# 5500 is caused by this issue. Appender has uninitialized data that it assigns to. And since the invariant is called before opAssign is, the invariant is called on garbage data which may or may not pass the invariant. Given that opAssign is supposed to completely replace the state of the object (as it is doing in the case of bug# 5500), I really do think that the invariant should not be called before opAssign is called. It's easy to have a struct which actually passes its invariant in its init state which fails the invariant upon opAssign, because the memory was initialized to void or otherwise not initialized when allocated. And stuff like appender is going to do that quite legitimately and safely. So, I think that bug# 5500 is more evidence that the invariant should _not_ be called before opAssign is called. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 24, 2012 [Issue 5058] invariant() should not be called before opAssign() | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=5058 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |INVALID --- Comment #11 from Walter Bright <bugzilla@digitalmars.com> 2012-01-23 23:41:34 PST --- An invariant should be written so that .init passes. Anything else would thoroughly break how D initializes objects. This is not a bug, it is as designed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation