1

On cppreference I see the following text:

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.

Hovewer, I wasn't able to find any confirmation of this in C++17 standard.

Function parameters, as subexpressions, should comply with [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 ]

Which means, that function parameters calculation should be unsequenced unless it's prohibited by any other points in the standard. I tried to find a substring "indeterminately" in the standard text, and none of 10 occurrences look relevant to function call arguments.

So, the question is: are the function parameters unsequenced or indeterminately sequenced in C++17?

alexeykuzmin0
  • 6,008
  • 1
  • 24
  • 49

1 Answers1

2

[expr.call]/5 The postfix-expression is sequenced before each expression in the expression-list and any default argument. The initialization of a parameter, including every associated value computation and side effect, is indeterminately sequenced with respect to that of any other parameter.

Emphasis mine.

Igor Tandetnik
  • 45,980
  • 4
  • 51
  • 75