Does anyone know where the listing for levels of operator precedence for D version 1.0 are located on line?
In the page http://www.digitalmars.com/d/1.0/expression.html, the stuff appear higher have lower precedence in general. To get the specific precedence, follow the parser rules.
15. typeof() typeid() is()
assert() import() mixin()
function delegate
T.x x!y
variables
(...) [...] //(Primary expressions)
"x" "y" //(Concatenation between string literals)
14. . x++ x--
x() x[] //(Postfix operators)
13. & ++x --x *
+x -x ! ~ (T).
new delete
cast //(Prefix operators)
12½. ^^ //(Power. D2 only)
12. * / % ///(Multiplicative operators)
11. + - ~ //(Additive operators)
10. >> << >>> //(Bitwise shift)
9. == != is !is
> < >= <=
!> !< !>= !<=
<> !<> <>= !<>=
in !in //(Comparison operators)
8. & //(Bitwise AND)
7. ^ //(Bitwise XOR)
6. | //(Bitwise OR)
5. && //(Logical AND)
4. || //(Logical OR)
3. ?: //(Conditional operator)
2. op= //(Assignment operator)
1⅔. => //(Lambda. D2 only. Not really an operator)
1⅓. .. //(Slicing. Not really an operator)
1. , //(Comma operator)
See the D 1.0 page on Expressions.
Order Of Evaluation
The following binary expressions are evaluated in strictly left-to-right order:
CommaExpression, OrOrExpression, AndAndExpression
The following binary expressions are evaluated in an implementation-defined order:
AssignExpression, OrExpression, XorExpression, AndExpression, CmpExpression, ShiftExpression, AddExpression, CatExpression, MulExpression, function parameters
It is an error to depend on order of evaluation when it is not specified. For example, the following are illegal:
i = i++; c = a + (a = b); func(++i, ++i);
If the compiler can determine that the result of an expression is illegally dependent on the order of evaluation, it can issue an error (but is not required to). The ability to detect these kinds of errors is a quality of implementation issue.
At least, that was the link as mentioned by Walter (D creator) in this mailing list thread.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With