Re: C to Java Byte Code
In article <2uas2oF27j6u9U 1@uni-berlin.de>,
Alfred Z. Newmane <a.newmane.remo ve@eastcoastcz. com> wrote:[color=blue]
>Richard Tobin wrote:[/color]
[color=blue][color=green]
>> No. It starts with the value 3, which is the value of the right-hand
>> side. Then that value is assigned to i, and i is incremented, but the
>> order of these two operations is not defined.[/color][/color]
[color=blue]
>Good point, thanks for mentioning it :-) Still, either order will still
>end up with 4. Either i ++'s to 4 and assigns that bakc to i, or i gets
>3, then ++'ed, giving 4 as well.[/color]
No. The possibilities include
- the rhs is evaluated as 3
- the rhs (3) is assigned to i
- i is incremented
where the result is that i ends up as 4, and
- the rhs is evaluated as 3
- i is incremented
- the rhs (3) is assigned to i
where i ends up as 3.
The standard allows any other behaviour, but the results above are the
most natural ones.
-- Richard
In article <2uas2oF27j6u9U 1@uni-berlin.de>,
Alfred Z. Newmane <a.newmane.remo ve@eastcoastcz. com> wrote:[color=blue]
>Richard Tobin wrote:[/color]
[color=blue][color=green]
>> No. It starts with the value 3, which is the value of the right-hand
>> side. Then that value is assigned to i, and i is incremented, but the
>> order of these two operations is not defined.[/color][/color]
[color=blue]
>Good point, thanks for mentioning it :-) Still, either order will still
>end up with 4. Either i ++'s to 4 and assigns that bakc to i, or i gets
>3, then ++'ed, giving 4 as well.[/color]
No. The possibilities include
- the rhs is evaluated as 3
- the rhs (3) is assigned to i
- i is incremented
where the result is that i ends up as 4, and
- the rhs is evaluated as 3
- i is incremented
- the rhs (3) is assigned to i
where i ends up as 3.
The standard allows any other behaviour, but the results above are the
most natural ones.
-- Richard
Comment