4 ms·
A-mazing Also, notice the difference in number of results between C and C++ below: http://www.google.com/codesearch?hl=en&lr=&q=if%5Cs*%5C%28%5Cs*%5Cw%2B%5Cs*
by ignifero 16y ago
A-mazing
Also, notice the difference in number of results between C and C++ below:
http://www.google.com/codesearch?hl=en&lr=&q=if%5Cs*%5C%28%5Cs*%5Cw%2B%5Cs*%3D%5Cs*%5Cd%2B%5Cs*%5C%29+file%3A^.*%5C.c%24&sbtn=Search http://www.google.com/codesearch?hl=en&lr=&q=if%5Cs*...
vs
http://www.google.com/codesearch?hl=en&lr=&q=if%5Cs*%5C%28%5Cs*%5Cw%2B%5Cs*%3D%5Cs*%5Cd%2B%5Cs*%5C%29+file%3A^.*%5C.cpp%24&sbtn=Search http://www.google.com/codesearch?hl=en&lr=&q=if%5Cs*...
- benburleson 16y agoThat'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.
- loumf 16y agoThe code is generating code for a different language -- the = is always in a string.
- learner4life 16y agoMaybe I am feeling dense, but I do not understand what you are trying to point out. None except one are errors as they relate to embedded sql statements (where Equal To is the comparison operator).
- ignifero 16y agomaybe we re seeing different results. mine have 8 incorrect assignments in the first page