dmd-2.067.0-b1
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Feb 13 06:01:06 PST 2015
On Friday, 13 February 2015 at 13:25:55 UTC, Steven Schveighoffer
wrote:
> Yes, the operator precedence (curiously not defined in the
> spec) is here:
>
> http://wiki.dlang.org/Operator_precedence
>
> Conditional operator is above assignment operators.
It's specified through the grammar [1]:
----
AssignExpression:
ConditionalExpression
ConditionalExpression = AssignExpression
[...]
ConditionalExpression:
OrOrExpression
OrOrExpression ? Expression : ConditionalExpression
----
The third operand of ConditionalExpression cannot be an
AssignExpression without parentheses.
So `foo ? bar : baz = qux` can only be interpreted as `(foo ? bar
: baz) = qux`.
[1] http://dlang.org/expression.html
More information about the Digitalmars-d-learn
mailing list