Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

operator=

29 views
Skip to first unread message

Fraser Ross

unread,
Jul 26, 2015, 11:26:19 AM7/26/15
to
I have copied this from a books eratta list. Should the code with
operator= not be (i1.operator=(i2)).operator=(i3); ?

int i1,i2,i3;
It turns out that "(i1 = i2) = i3;" yields undefined results when i1,
i2, and i3 are ints, because i1 is modified more than once without an
intervening sequence point. This is not a problem for user-defined
types, because for such types, the above is be equal to
i1.operator=(i2.operator=(i3)); and that's fine, because there's a
sequence point before and after each function call.



Fraser.
Message has been deleted
0 new messages