Page 1 of 1

UB or not UB?

Posted: Wed Oct 02, 2013 6:47 am
by AlexeyKnyshev
Is it undefined behavior?

Code: Select all

int i = 1;
i = i++ + ++i; 
printf("%d", i);
p.s. I'm sure about UB in " i = ++i + ++i; "

Re: UB or not UB?

Posted: Wed Oct 02, 2013 9:05 am
by saejox
Even 'i = i++' is undefined.
There is a nice wiki article about it:
http://en.wikipedia.org/wiki/Sequence_point