[webkit-dev] strcmp result checking
Peter Kasting
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
on.
PK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20091216/897814c0/attachment.html>
More information about the webkit-dev
mailing list