CFLint
CFLint copied to clipboard
Add a warning for functions like listFind() and compare() used without a comparison in conditionals
It happens to write code like this:
if(listFindNoCase("a,b", someVar))
{
doSomething();
}
this should be reported at least as a warning because the intended logic is probably
if(listFindNoCase("a,b", someVar) gt 0)
{
doSomething();
}
hmm. I agree with compare() -- the statement is true when the arguments are not equal - which reads really strange. However, I don't see a problem with listcompare. When it is found, you will get a true (non-zero), and when it is not found a false (0).
I do use listFindNoCase
like this quite often since there is no more suitable BIF that returns a boolean.