[webkit-dev] strcmp result checking
pkasting at google.com
Wed Dec 16 22:02:52 PST 2009
On Wed, Dec 16, 2009 at 9:12 PM, Alexey Proskuryakov <ap at webkit.org> wrote:
> As current style rules say that tests for zero/non-zero should all be done
> without equality comparisons. However, this rule can cause significant
> readability problems if blindly applied to strcmp: if (!strcmp(string,
> "foobar")) naturally reads as "does not equal".
I have always found !strcmp() to be more readable than the == 0 form, rather
than less. I don't have a logical explanation for this, it just reads as
"if strcmp didn't find differences" to me.
I definitely wish we'd be consistent in our usage whichever way people agree
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev