D Logic bug

James Japherson JJ at goolooking.com
Thu Oct 11 14:35:34 UTC 2018


Took me about an hour to track this one down!

A + (B == 0) ? 0 : C;

D is evaluating it as

(A + (B == 0)) ? 0 : C;


The whole point of the parenthesis was to associate.

I usually explicitly associate precisely because of this!

A + ((B == 0) ? 0 : C);

In the ternary operator it should treat parenthesis directly to 
the left as the argument.

Of course, I doubt this will get fixed but it should be noted so 
other don't step in the same poo.



More information about the Digitalmars-d mailing list