Order of Evaluation of Operands
Most programmers simply assume that the operands are evaluated left to right. C++ does not specify the order in which the operands of most operators (including
+) are to be evaluated. Therefore, you must make no assumption about the order in which these calls execute. The calls could in fact execute
fibonacci(2) first, then
fibonacci(1), or they could execute in the reverse order:
fibonacci(2). In this program and in most others, it turns out that the final result would be the same. However, in some programs the evaluation of an operand can have side effects (changes to data values) that could affect the final result of the expression.
C++ specifies the order of evaluation of the operands of ...