<分区>
关于 cppreference我看到以下文字:
In a function call, value computations and side effects of the initialization of every parameter are indeterminately sequenced with respect to value computations and side effects of any other parameter.
但是,我无法在 C++17 标准中找到对此的任何确认。
函数参数,作为子表达式,应符合[intro.execution.17]:
Except where noted, evaluations of operands of individual operators and of subexpressions of individual expressions are unsequenced. [ Note: In an expression that is evaluated more than once during the execution of a program, unsequenced and indeterminately sequenced evaluations of its subexpressions need not be performed consistently in different evaluations. — end note ] The value computations of the operands of an operator are sequenced before the value computation of the result of the operator. If a side effect on a memory location (4.4) is unsequenced relative to either another side effect on the same memory location or a value computation using the value of any object in the same memory location, and they are not potentially concurrent (4.7), the behavior is undefined. [ Note: The next section imposes similar, but more complex restrictions on potentially concurrent computations. — end note ]
这意味着,除非标准中的任何其他点禁止,否则函数参数计算应该是无序的。我试图在标准文本中“不确定地”找到一个子字符串,但 10 次出现看起来都与函数调用参数无关。
因此,问题是:C++17 中的函数参数是无序的还是不确定的?