[Issue 9732] Do not call opAssign() for the first assignment to member in the constructor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 17 08:56:50 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9732
--- Comment #6 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-03-17 08:56:49 PDT ---
(In reply to comment #4)
> (In reply to comment #1)
> > The problem is that opAssign can perform deep copy operations for which
> > blitting isn't enough.
>
> That's why we have postblit. If anything, I'd expect postblit to be safer then
> opAssign: postblit has no pre-state, whereas opAssign may make assumptions
> about it's current (run-time initialized?) state.
Postblit does not cover cases when object assigned to struct is of different
type - this is main purpose of overloading opAssign in addition to defining
postblit.
Making assumptions about state of object on entering postblit and opAssign is
very risky, you can effectively receive garbage.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list