-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathoperator-precedence.txt
53 lines (51 loc) · 3.32 KB
/
operator-precedence.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Asteria Operator Precedence
Bitwise, equality and coalescence operators have different precedence from
other languages. The consideration was based on estimation about their usual
use cases. More common cases deserve higher precedence and fewer parentheses.
==============================#==============================#===============
Precedence (descending) | Operators | Associativity
==============================#==============================#===============
| ++ -- |
Postfix operators | ( ) [ ] . | Left-to-right
| [^] [$] [?] |
------------------------------+------------------------------+---------------
| + - ~ ! |
| ++ -- |
| unset countof typeof |
| __isvoid __abs __sign |
Prefix operators | __sqrt __isnan __isinf | Right-to-left
| __round __iround __floor |
| __ifloor __ceil __iceil |
| __trunc __itrunc __lzcnt |
| __tzcnt __popcnt |
------------------------------+------------------------------+---------------
Coalescence operator | ?? |
------------------------------+------------------------------+
Multiplicative operators | * / % |
------------------------------+------------------------------+
Additive operators | + - |
------------------------------+------------------------------+
Shift operators | <<< >>> << >> |
------------------------------+------------------------------+
Bitwise AND operator | & |
------------------------------+------------------------------+ Left-to-right
Bitwise OR and XOR operators | | ^ |
------------------------------+------------------------------+
Relational operators | < > <= >= |
------------------------------+------------------------------+
Equality operators | == != <=> </> |
------------------------------+------------------------------+
Logical AND operator | && |
------------------------------+------------------------------+
Logical OR operator | || |
------------------------------+------------------------------+---------------
| ? : ?= : |
Conditional operator | *= /= %= += -= |
| <<<= >>>= <<= >>= | Right-to-left
Assignment operators | &= ^= |= |
| &&= ||= ??= = |
------------------------------+------------------------------+---------------
| catch __addm __subm |
Special operators | __mulm __adds __subs | N/A
| __muls __fma |
==============================#==============================#===============