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

David Levin levin at chromium.org
Tue Feb 2 17:43:23 PST 2010


The style guide is correct. Your greps are incorrect for the correct style
which is why you got "0 correct uses".

Proof by counter example:
http://trac.webkit.org/browser/trunk/WebCore/rendering/HitTestResult.cpp#L250

On Tue, Feb 2, 2010 at 5:32 PM, Dumitru Daniliuc <dumi at chromium.org> wrote:

> 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
>
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100202/a9c75e8c/attachment.html>


More information about the webkit-dev mailing list