According to the C++23 standard, what is the output of this program?
#include <iostream>
int i;
void f(int x) {
std::cout << x << i;
}
int main() {
i = 3;
f(i++);
}Is there a sequence point associated with a function call?
34
According to §[intro.execution]¶11 in the standard, when calling a function:
(...) every argument expression (...) [is] sequenced before every expression or statement in the body of the called function.
Hence, in the expression f(i++), f is called with a parameter of the original value of i, but i is incremented before entering the body of f.