Input/Output stream operators associativity in theory:
LEFT TO RIGHT
(for example, according to this: Sait Mary's University website
Input/Output stream operators associativity on practice:
#include <iostream>
int func0() {
std::cout << "func0 executed" << std::endl;
return 0;
}
int func1() {
std::cout << "func1 executed" << std::endl;
return 1;
}
int func2() {
std::cout << "func2 executed" << std::endl;
return 2;
}
int main() {
std::cout << func0() << func1() << func2() << std::endl;
return 0;
}
Output (MSVCPP 2010, 2012):
func2 executed
func1 executed
func0 executed
012
Press any key to continue . . .
This sample demonstrates that functions are called in RIGHT TO LEFT order (despite of their values are printed as expected LEFT TO RIGHT).
The question: How this code sample correlates with Standard words about LEFT TO RIGHT execution? And why functions execution performed in RIGHT TO LEFT order?