{} 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
"if".
A few days ago, this rule brought a real bug to me.
Existing code:
if (attr->name() == fooAttr)
doSometing();
else if (attr->name() == barAttr) ...
I added "if" like:
if (attr->name() == fooAttr)
if (isBaz())
doSometing();
else if (attr->name() == barAttr) ...
The "else" clause unexpectedly attached to "if (isBaz())"
I wasted about an hour to found this bug.
--
TAMURA Kent
Software Engineer, Google
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev