There are 16 precedence categories, some of which contain only one operator. Operators in the same category have equal precedence with each other.
Where duplicates of operators appear in the table, the first occurrence is unary, the second binary. Each category has an associativity rule: left to right, or right to left. In the absence of parentheses, these rules resolve the grouping of expressions with operators of equal precedence.
The precedence of each operator in the following table is indicated by its order in the table. The first category (on the first line) has the highest precedence. Operators on the same line have equal precedence.
Operators |
Associativity |
() [] -> :: . |
left to right |
! ~ + - ++ -- & * sizeof new delete |
right to left |
.* ->* |
left to right |
* / % |
left to right |
+ - |
left to right |
<< >> |
left to right |
< <= > >= |
left to right |
== != |
left to right |
& |
left to right |
^ |
left to right |
| |
left to right |
&& |
left to right |
|| |
right to left |
?: |
left to right |
= *= /= %= += -= &= ^= |= <<= >>= |
right to left |
, |
left to right |
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|