Because I have learned how to compile, I always think that the computer is read from left to right... therefore, there is a potential consciousness that the priority order in C ++ is also viewed from left to right,Then you can view the priority of the symbol,In fact, in C ++, except for logic and logic or, C ++ does not clearly define the sequence of binary operators,
The compiler is free to provide the best implementation method. Only when the "implementation efficiency" andProgramSeek a balance between "potential defects" in language use.
Because the order in which the operands are solved usually has no effect on the result.Only when the two operands of the binary operator involve the same objectAnd change the value of this object, the order in which the operands are solved will affect the calculation result. The latter case will only appear in some (or even a few) programs. In practice, this "potential defect" can be compensated by the efforts of programmers, but the improvement in "implementation efficiency" can benefit all the programs that use the compiler, therefore, it must be greater than the disadvantage.
For example, if (IA [index ++] <Ia [Index]):
The behavior of this expression is not clearly defined. The problem is: <both the left and right operands use the index variable, but the left operand changes the value of this variable. Assume that the initial index value is 0.
The interpreter can evaluate the value of this expression in one of the following two ways. The C ++ language does not guarantee the computing order from left to right.
If (IA [0] <Ia [0]) // execution if RHS is evaluated first
If (IA [0] <Ia [1]) // execution if LHS is evaluated first
Depends on the Compiler