23-06-2006, 01:30 PM
Hi
In Rule 12.2
I don't understand, what could go wrong here:
1. x = y = y = z / 3 ;
2. x = y = y++;
If x = 1, y = 2, z = 3, I would say,
- for 1. the result for x is everytime 1
- for 2. the result for x is everytime 3
What could a compiler make different here?
thanks
In Rule 12.2
Quote:nested assignment statements
Assignments nested within expressions cause additional side effects. The best way to avoid any chance of this leading to a dependence on order of evaluation is to not embed assignments within expressions.
For example, the following is not recommended:
x = y = y = z / 3 ;
x = y = y++;
I don't understand, what could go wrong here:
1. x = y = y = z / 3 ;
2. x = y = y++;
If x = 1, y = 2, z = 3, I would say,
- for 1. the result for x is everytime 1
- for 2. the result for x is everytime 3
What could a compiler make different here?
thanks
<t>best regards,<br/>
Manni</t>
Manni</t>