D Logic bug

Steven Schveighoffer schveiguy at gmail.com
Thu Oct 11 23:29:05 UTC 2018


On 10/11/18 7:17 PM, Jonathan Marler wrote:

> I had a look at the table again, looks like the ternary operator is on 
> there, just called the "conditional operator".  And to clarify, D's 
> operator precedence is close to C/C++ but doesn't match exactly.  This 
> is likely a result of the grammar differences rather than an intention 
> one.  For example, the "Conditional operator" in D actually has a higher 
> priority than an assignment, but in C++ it's the same and is evaluated 
> right-to-left.  So this expression would be different in C++ and D:
> 

Not in my C/D code. It would have copious parentheses everywhere :)

That case is actually very strange, I don't know if it's something 
that's really common.

-Steve


More information about the Digitalmars-d mailing list