- 论坛徽章:
- 0
|
Order of evaluation of subexpressions
Many programming languages do not specify the order of evaluation of the sub-expressions of a complete expression. If one or more of the sub-expressions has side effects, then the result of evaluating the full-expression may be different depending on the order of evaluation of the sub-expressions. For example, given
, where f and g both modify b, the result stored in a may be different depending on whether f(b) or g(b) is evaluated first.
...
In other languages, such as Java, the order of evaluation of operands and function arguments is explicitly defined.
http://en.wikipedia.org/wiki/Unspecified_behavior
写得很清晰,这已经没有继续讨论的必要了。
[ 本帖最后由 langue 于 2010-1-8 22:10 编辑 ] |
|