Operator Precedence and Associativity
Tyro[17]
ridimz at yahoo.com
Tue Nov 5 19:34:49 PST 2013
I’m sure the following table is missing a few items but am unclear
what they are. For starters these <>, <>=, >>>, , !<>, !<>=
belong on the table but I’m 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");
}
More information about the Digitalmars-d-learn
mailing list