This is sort of a follow-up to Could a C++ implementation, in theory, parallelise the evaluation of two function arguments?
Suppose I have the following C++11 program:
#include <cstdio>
using std::printf;
int g() { printf("1\n"); printf("3\n"); return 2; }
int h() { printf("2\n"); printf("4\n"); return 3; }
void f(int a, int b) { printf("%i\n", a+b); }
int main() { f(g(), h()); }
Certainly the following outputs are observable:
1 3 2 4 5
2 4 1 3 5
What about 1 2 3 4 5?
(As far as I can tell, the only constraints are that 1 is sequenced before 3, 2 is sequenced before 4, and both 3 and 4 are sequenced before 5.)