On Saturday, 7 April 2018 at 20:57:23 UTC, kdevel wrote:
On Saturday, 7 April 2018 at 16:52:00 UTC, Patrick Schluter
wrote:
[...]
The odd man out is C++ [1], assignment has higher precedence
because of right to left evaluation.
Your reference [1] is not even a witness to your claim. The
precedence table says that the "Ternary conditional" has the
*same* precedence as the "Direct Assigment", namely "16".
You may find an in-depth discussion of the C++ case in
https://stackoverflow.com/questions/7499400/ternary-conditional-and-assignment-operator-precedence
My formulation was ambiguous, it is the same precedence as the
link says. The link also says that's it's right to left
evaluation. This means that for expression:
a ? b = c : d = e;
right to left evaluation will make the = e assignment higher
priority than the b = c assignment or the ternary even if they
have the same priority level. The operative word was the right to
left but granted I could have formulated it better.