Simple operator precidence chart (and associativity)?

Jos van Uden user at domain.invalid
Wed Mar 14 05:23:03 PDT 2012


On 14-3-2012 0:14, Timon Gehr wrote:
> I don't think there is, but I think I can create one:
>
> ! // 1 template instantiation
> => // 2 goesto, binds weaker to the right
> . ++ -- ( [ // 3 postfix operators
> ^^ // 4 power (right-associative)
> & ++ -- * - + ! ~ // 5 prefix operators
> * / % // 6 multiplicative operators
> + - ~ // 7 additive operators
>  >> << >>> // 8 shift operators
> == != > < >= <= \ // 9 relational operators
> !> !< !>= !<= <>\
> !<> <>= !<>= in \
> !in is !is
> & // 10 bitwise AND (ambiguous with 9)
> ^ // 11 bitwise XOR (ambiguous with 9)
> | // 12 bitwise OR (ambiguous with 9)
> && // 13 logical AND
> || // 14 logical OR
> ?: // 15 conditional operator
> /= &= |= -= += \ // 16 assignment operators (right-associative)
> <<= >>= >>>= = \
> *= %= ^= ^^= ~=
> => // 17 goesto, binds stronger to the left
> , // 18 comma operator
> .. // range (not actually an operator)

The TDPL has a list of expressions in decreasing precedence
on pages 61-63. Some of these operators, like <> or ^^= are
not listed there.

Is there a difference between != and <> ?

Why is the "goesto" operator listed twice? Is that accidental?

Jos







More information about the Digitalmars-d-learn mailing list