4 ms·
That's why I write comparisons like if (CONSTANT == variable)
by benburleson 16y ago
That's why I write comparisons like
if (CONSTANT == variable)
- klochner 16y ago"yoda conditions": http://stackoverflow.com/questions/2349378/new-programming-jargon-you-coined/2430307#2430307 http://stackoverflow.com/questions/2349378/new-programming-j...
- derleth 16y agoYoda conditions, those are called. http://united-coders.com/christian-harms/what-are-yoda-conditions http://united-coders.com/christian-harms/what-are-yoda-condi...
- Splines 16y agoI know it's safer, but personally I find it harder to read. Especially if the constant is a #define or enum and is similar in format to the variable in question.
- nostrademons 16y agoI personally like Yoda Conditions, but a few coworkers have pointed out that any linter worth its salt will catch an = inside a conditional, so this doesn't actually gain much in safety. I've stopped using them because there a large number of coworkers find them confusing.