www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Operator Precedence and Associativity

reply "Tyro[17]" <ridimz yahoo.com> writes:
I知 sure the following table is missing a few items but am unclear
what they are. For starters these <>, <>=, >>>, , !<>, !<>=
belong on the table but I知 not sure where. I am also not sure if
these ...,  , # belong there at all. There might be other errors
or missing operators. Request assist to complete correctly.


           Operator Precedence and Associativity Rules in D
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     !           template instantiation
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     =>          lambda                                right-to-left
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     ()          function call                         left-to-right
     []          array element
     .           member selection
     ++          post increment                        right-to-left
     --          post decrement
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     !           logical not                           right-to-left
     ~           bitwise complement
     -           unary minus
     ++          pre increment
     --          pre decrement
     *           contents of (dereference)
     new
     ref
     in
     !in
     out
     inout
     cast()
     is
     !is
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     ^^          power                                 left-to-right
     *           multiply
     /           divide
     %           remainder
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     +           add                                   left-to-right
     -           subtract
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     <<          bitwise left shift                    left-to-right
     >>          bitwise right shift
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     <           arithmetic less than                  left-to-right
     !>=         arithmetic not greater than or equal to
     >           arithmetic greater than
     !<=         arithmetic not less than or equal to
     <=          arithmetic less than or equal to
     !>          arithmetic not greater than
     >=          arithmetic greater than or equal to
     !<          arithmetic not less than
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     ==          arithmetic equal                      left-to-right
     !=          arithmetic not equal
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     &           bitwise and                           left-to-right
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     ^           bitwise exclusive or                  left-to-right
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     |           bitwise or                            left-to-right
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     &&          logical and                           left-to-right
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     ||          logical or                            left-to-right
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     ? :         conditional expression                right-to-left
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     =           assignment operator                   right-to-left
     also +=    -=    *=    /=    %=
     <<=    >>=    &=    ^=    |=
     ~=    ^^=    >>>=
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     =>          lambda                                left-to-right
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     ,           sequential expression                 left-to-right
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧
     ..          range separator
覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧覧

-- 

Andrew Edwards
--------------------
http://www.akeron.co
auto getAddress() {
     string location = " ", period = ".";
     return ("info" ~ location ~ "afidem" ~ period ~ "org");
}
Nov 05 2013
next sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Tuesday, November 05, 2013 22:34:49 Tyro[17] wrote:
 I=E2=80=99m sure the following table is missing a few items but am un=
clear
 what they are. For starters these <>, <>=3D, >>>, , !<>, !<>=3D
 belong on the table but I=E2=80=99m not sure where.
I'm not quite sure where they go, but I believe that all of them (save = maybe=20
) are supposed to be deprecated, in which case, it matters a lot les=
s where=20 they'd go in the table. - Jonathan M Davis
Nov 05 2013
parent "Tyro[17]" <ridimz yahoo.com> writes:
On 11/5/13, 11:36 PM, Jonathan M Davis wrote:
 On Tuesday, November 05, 2013 22:34:49 Tyro[17] wrote:
 I窶冦 sure the following table is missing a few items but am unclear
 what they are. For starters these <>, <>=, >>>, , !<>, !<>=
 belong on the table but I窶冦 not sure where.
I'm not quite sure where they go, but I believe that all of them (save maybe
 ) are supposed to be deprecated, in which case, it matters a lot less where
they'd go in the table. - Jonathan M Davis
OK thanks. As for the actual chart, I take it there wasn't anything glaringly wrong with what's already in it? Andrew
Nov 07 2013
prev sibling parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 11/06/2013 04:34 AM, Tyro[17] wrote:
 I知 sure the following table is missing a few items but am unclear
 what they are. For starters these <>, <>=, >>>, , !<>, !<>=
 belong on the table but I知 not sure where. I am also not sure if
 these ...,  , # belong there at all. There might be other errors
 or missing operators. Request assist to complete correctly.
 ...
I have some time ago compiled my own table, which can be found here: http://wiki.dlang.org/Operator_precedence
Nov 06 2013
parent "Tyro[17]" <ridimz yahoo.com> writes:
On 11/6/13, 6:43 AM, Timon Gehr wrote:
 On 11/06/2013 04:34 AM, Tyro[17] wrote:
 I知 sure the following table is missing a few items but am unclear
 what they are. For starters these <>, <>=, >>>, , !<>, !<>=
 belong on the table but I知 not sure where. I am also not sure if
 these ...,  , # belong there at all. There might be other errors
 or missing operators. Request assist to complete correctly.
 ...
I have some time ago compiled my own table, which can be found here: http://wiki.dlang.org/Operator_precedence
Thanks. Did not see this earlier. I will compare my list and adjust accordingly.
Nov 07 2013