Possible Duplicate:
cout << order of call to functions it prints?
What is the difference between order and associativity when evaluating a compound expression?
In the following example, I don't see the effect of order on the result
of expression. The result
is always 3
like the functions would have been called from left to right as arithmetic operators being left associative.
#include <iostream>
using std::cout;
using std::endl;
int Func1(int &i)
{
return i;
}
int Func2(int &i)
{
return i++;
}
int main()
{
for (int index = 0; index < 999999999; index++)
{
int i = 0;
int result = (Func2(i) + Func1(i) + Func1(i) + Func2(i));
cout << result << endl;
}
}