表达式计算 (C)Expression Evaluation (C)

涉及赋值、一元递增、一元递减或调用函数的表达式可能具有其计算附带的结果(副作用)。Expressions involving assignment, unary increment, unary decrement, or calling a function may have consequences incidental to their evaluation (side effects). 当达到“序列点”时,确保对序列点后面的任何内容执行计算之前已计算序列点前面的所有内容(包括任何副作用)。When a "sequence point" is reached, everything preceding the sequence point, including any side effects, is guaranteed to have been evaluated before evaluation begins on anything following the sequence point.

“副作用”是由表达式的计算引起的更改。"Side effects" are changes caused by the evaluation of an expression. 只要表达式计算更改变量的值,就会出现副作用。Side effects occur whenever the value of a variable is changed by an expression evaluation. 所有赋值运算都具有副作用。All assignment operations have side effects. 如果函数调用通过直接赋值或使用指针进行间接赋值来更改外部可见项的值,则函数调用还会产生副作用。Function calls can also have side effects if they change the value of an externally visible item, either by direct assignment or by indirect assignment through a pointer.

另请参阅See Also

操作数和表达式Operands and Expressions