On 10/11/2018 07:35 AM, James Japherson wrote:
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;
Friends don't let friends use the ternary operator except in trivial cases.
This would be a good thing for a linter to check.
The whole point of the parenthesis was to associate.
Yes. The expression would otherwise have been parsed as:
((A + B) == 0) ? 0 : C
It might be a good idea to deprecate arithmetic with booleans, which
would have caught this specific error.