[webkit-dev] unwritten rules of webkit style

TAMURA, Kent tkent at chromium.org
Wed Sep 2 20:15:25 PDT 2009

> {} should be added in this case:

>> if (condition1         && condition2)
>>      statement;

> Not according to current WebKit style because it is a single line
> statement.

I don't like this rule. We need to be careful to add/remove a sentence in an
existing block, need to guess how many sentences to be added when we add

A few days ago, this rule brought a real bug to me.

Existing code:
   if (attr->name() == fooAttr)
   else if (attr->name() == barAttr) ...

I added "if" like:

   if (attr->name() == fooAttr)
       if (isBaz())
   else if (attr->name() == barAttr) ...

The "else" clause unexpectedly attached to "if (isBaz())"
I wasted about an hour to found this bug.

Software Engineer, Google

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090903/76db4566/attachment.html>

More information about the webkit-dev mailing list