[webkit-dev] unwritten rules of webkit style

Dimitri Glazkov dglazkov at chromium.org
Wed Sep 2 12:28:37 PDT 2009


I don't think the intent of this thread was to create new rules. Let's
stick with documenting existing style practices.

:DG<

On Wed, Sep 2, 2009 at 12:16 PM, Yong Li<yong.li at torchmobile.com> wrote:
> For multi-line condition, the following style is most readable to me.
>
> if (condition1
>     && condition2)
> {
>      // code...
> }
>
>
> ----- Original Message -----
> From: Yong Li
> To: David Levin
> Cc: WebKit Development
> Sent: Wednesday, September 02, 2009 3:05 PM
> Subject: Re: [webkit-dev] unwritten rules of webkit style
>
> Current guideline also contains these 2 cases that {} should be used. I
> think when the condition is multi-lined, this should also apply.
>
> (BTW, hate the existing rule "no braces for one line". it doesn't give any
> benefit. worse than "always use braces")
>
> if (condition) {
>     // Some comment
>     doIt();
> }
>
> if (condition) {
>     myFunction(reallyLongParam1, reallyLongParam2, ...
>         reallyLongParam5);
> }
>
> ----- Original Message -----
> From: David Levin
> To: Yong Li
> Cc: WebKit Development
> Sent: Wednesday, September 02, 2009 2:56 PM
> Subject: Re: [webkit-dev] unwritten rules of webkit style
>
>
> On Wed, Sep 2, 2009 at 11:54 AM, Yong Li <yong.li at torchmobile.com> wrote:
>>
>> {} should be added in this case:
>>
>>
>> if (condition1
>>         && condition2)
>>     statement;
>
> Not according to current WebKit style because it is a single line statement.
>
> ________________________________
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
>


More information about the webkit-dev mailing list