Hi
I know that an object should have its stored value modified at most once between the previous and the next sequence point. That is the C standard. It means side effects take place in an unspecified order between sequence points. Given a line:
This expression statement has two side effects: assignment and increment. But I think operation on 'i' is not undefined. The operation order should look like this:Code:i = ++i;
1. Increment i
2. Get i's value
3. Assign the value to i
Of course some compilers often just do the first operation, but considering its semantics there seems no other order with this statement. Then why does compiler still report 'operation on i may be undefined'? Only because it has two side effects?