关于操作数求值顺序的矛盾

Contradiction about Order of Evaluation of operands

当我从 deitel c 学习 C 中的递归函数时,我看到了这句话:

Standard C does not specify the order in which the operands of most operators (including +) are to be evaluated.

而且书上还说:

associativity of '+' from left to right

操作数的计算顺序:

谁能解释这是为什么?

求值顺序和结合律是两个不同的东西,举个例子:

int x = func1() - func2() - func3(); //having int return types

在这个表达式中,你不知道 func1() 是先计算还是最后计算,也就是说,你不知道哪个函数会被调用,也不知道 return 它的值会先被计算,但是你知道关联性,与 + 一样,将是从左到右的,首先是 func1() - func2() 然后是减法的结果 - func3().

There is no concept of left-to-right or right-to-left evaluation in C, which is not to be confused with left-to-right and right-to-left associativity of operators: the expression f1() + f2() + f3() is parsed as (f1() + f2()) + f3() due to left-to-right associativity of operator+, but the function call to f3() may be evaluated first, last, or between f1() or f2() at run time.

https://en.cppreference.com/w/c/language/eval_order