This is a kind of continuation. Can a C ++ implementation theoretically parallelize 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()); }
Of course, the following outputs are observed:
1 3 2 4 5 2 4 1 3 5
How about 1 2 3 4 5?
(As far as I can tell, the only limitations are that 1 is sequenced to 3, 2 is sequenced to 4, and both 3 and 4 are sequenced to 5.)
source share