假设我有以下代码:
unsigned int func1();
unsigned int func2();
unsigned int func3();
unsigned int x = func1() | func2() | func3();
C++是否保证首先调用func1(),然后是func2(),最后是func3()?
还是编译器可以按照任何顺序调用函数?
此外,如果编译器希望,它可以实现短路优化吗? (例如,如果func1()返回~0,则编译器可以决定不调用func2()或func3(),因为它知道它们的返回值不可能影响分配给x的值吗?)