|Welcome to A!Die Software Studio|
The operators at the top of this list are evaluated first. Operators within a group have the same precedence. All operators have left-to-right associativity unless otherwise noted.
||scope resolution||no||left to right|
||function call||yes||left to right|
||Get type information||no|
||logical negation||yes||right to left|
||bitwise negation (complement)||yes|
||unary sign operations||yes|
||indirection and reference||yes|
||Size (of the type) of the operand in bytes||no|
||dynamic memory management||yes|
||Cast to a given type||yes|
||member pointer selector||yes||left to right|
||member object selector||no|
||arithmetic operations||yes||left to right|
||shift operations||yes||left to right|
||relational operations||yes||left to right|
||bitwise AND||yes||left to right|
||bitwise XOR||yes||left to right|
||bitwise OR||yes||left to right|
||logical AND||yes||left to right|
||logical OR||yes||left to right|
||Ternary conditional (if-then-else)||no||right to left|
||assignment||yes||right to left|
||Sequential evaluation operator||yes||left to right|
One important aspect of C++ that is related to operator precedence, is the order of evaluation and the order of side effects in expressions. In most circumstances, the order in which things happen is not specified. For example in
f() + g() whether
g() is called first is not specified.
Further, the effect of certain expressions is undefined. For example, consider the following code:
float x = 1; x = x / ++x;
The value of x and the rest of the behavior of the program after evaluating this expression is undefined. The program is semantically ill-formed: x is modified twice between two consecutive sequence points. For identification of sequence points, see Annex C of the C ISOStandard.
Expressions like the one above must be avoided. When in doubt, break a large expression into multiple statements to ensure that the order of evaluation is correct.
To determine the order of execution of operators consider these rules in the given order:
1) Consider effects of precedence-changing tokens: parentheses () and brackets 
2) Inherent precedence of operator.
3) When 1) above does not apply and two operators have the same precedence consider the operator associativity. For example, << associates left to right which means that the left-operand is the first operand, and = associates right to left. Note then that stream operators execute left to right while the expression a = b = c evaluates right to left.