[webkit-dev] unwritten rules of webkit style

Yong Li yong.li at torchmobile.com
Wed Sep 2 12:16:43 PDT 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090902/2bc55acf/attachment.html>


More information about the webkit-dev mailing list