[webkit-dev] Boolean operators in if-statements: left side or right side?

Dumitru Daniliuc dumi at chromium.org
Tue Feb 2 17:32:50 PST 2010


According to http://webkit.org/coding/coding-style.html, rule #5 (and the
check-webkit-style script), if-statements should look like this:

if (a
    && b)

and not like this:

if (a &&
    b)

However,

find WebCore/ -name *.cpp | xargs grep -E '^.*(&&|\|\|)\s*$' | wc -l = 925
incorrect uses
find WebCore/ -name *.h | xargs grep -E '^.*(&&|\|\|)\s*$' | wc -l = 81
incorrect uses
find WebCore/ -name *.cpp | xargs grep -E '^\s*(&&|\|\|).*$' | wc -l = 0
correct uses
find WebCore/ -name *.h | xargs grep -E '^\s*(&&|\|\|).*$' | wc -l = 0
correct uses


Should the rule be changed? Sorry if this was discussed already and I missed
the thread.

Thanks,
Dumi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100202/d02d33ee/attachment.html>


More information about the webkit-dev mailing list