c++ - sequenced before:the order of arguments of different functions -
#include <iostream> using namespace std; int f(int){cout << "f ";return 0;} int g(int){cout << "g ";return 0;} int a(){cout << "a ";return 0;} int b(){cout << "b ";return 0;} int main() { f(a()) + g(b()); return 0; }
i konw sequenced before f, b sequenced before g. f , g unsequenced.
how many results there?
1.a f b g
2.b g f
example 1 , 2 may happen. how these?
a b f g
a b g f
b f g
b g f
possibly or impossible?
the thing that's guaranteed b()
evaluated before g()
, , a()
before f()
. 2 ordering relations obeyed. output compatible ordering possible. in case, means outputs 1 6 may happen.
Comments
Post a Comment