3 ms·
Ternaries are often used as single-usage substitites for a variable, but it's not rare to see the ternary statement simply copied somewhere else if the same val
by mickronome 9y ago
Ternaries are often used as single-usage substitites for a variable, but it's not rare to see the ternary statement simply copied somewhere else if the same value is needed again.
Using ternaries only when it is free of side-effect can both helo avoid a class of unnecessary errors, and add meaningful semantic information that some code is, or should be, side-effect free.
It would be great if the compiler(s) in various languages supported enforcing it, but sometimes you take whatever you get.