I have been brushing up on my undefined behaviour rules, and read the following:
Undefined behavior and sequence points
Why is f(i = -1, i = -1) undefined behavior?
Why is `x-- > 0` not undefined behaviour, while `x = x--` is?
And In C++11, does `i += ++i + 1` exhibit undefined behavior?
And ended up with three questions:
- Do the undefined behaviour rules for terms of the form
i=i++
apply to non integral types? (The expression should translate toi.operator(i.operator++(i))
, and since each function call is a sequence point it should be well defined, if I understand the standard correctly) - Why is
f(i=-1, i=-1)
undefined behaviour in combination with "The result of the assignment operation is the value stored in the left operand after the assignment has taken place; the result is an lvalue" (ref)[https://stackoverflow.com/a/4190054/258418]? (I understand that the value of i is undefined afterwards, but the functioncall should be evaluated asf(-1, -1)
if I understand the standard correctly. - Which types of expressions became safe with c++11/14/1z, only preincrement/predecrement in simple assignment (no
op=
)?