Operator Precedence
Expressions follow the standard C/C++ operator precedence. In the table below, expressions are evaluated from high to low priorities. Operators at the same priority are evaluated from left-to-right.
|
Priority |
Operators |
Comments |
|
1 |
( ) |
Parenthesis (grouping) |
|
2 |
Literals, Functions, ++, and -- |
Post increment (++) and Post decrement (--) |
|
3 |
!, ~ |
Logical Negation (NOT) and Bitwise complement |
|
4 |
* |
Multiplication |
|
5 |
/, % |
Division and Modulus Division |
|
6 |
+, - |
Addition and Substraction |
|
7 |
<<, >> |
Bitwise Left and Right shift |
|
8 |
<, <=, >, >= |
Greater than/Less than Comparisons |
|
9 |
==, != |
Equals Comparisons |
|
10 |
& |
Bitwise AND |
|
11 |
^ |
Bitwise XOR |
|
12 |
| |
Bitwise OR |
|
13 |
&& |
Logical AND |
|
14 |
|| |
Logical OR |
|
15 |
=, +=, -=, *=, /=, %=, &=, ^=, |=, <<=, >>= |
Assignments |
Operations: Arithmetic, Bitwise, Logical, and Precedence
Functions: Arithmetic and Document