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?

  1. a b f g

  2. a b g f

  3. b f g

  4. 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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -