[webkit-dev] Proposing style guide change regarding braces on conditional arms

Maciej Stachowiak mjs at apple.com
Thu Dec 3 18:15:37 PST 2009


On Dec 3, 2009, at 5:48 PM, Michael Nordman wrote:

> what peter pitched and what mjs pitched are one and the same i think
> * When all arms of a conditional or loop are one physical line, do  
> not use braces.  If any arms are more than one physical line (even  
> if they are one logical line), use braces on all arms.
> One possible conservative modification to the rule is that if you  
> have a multi-block if ... else if ... else chain, then if even one  
> body has braces, all should. I think that would tend to reduce  
> rather than increase visual noise, as all the "else" keywords would  
> line up where right now they look ragged.

To be clear: my intent was to propose something different than Peter's  
suggestion. Specifically, I suggest we do *not* change the rule for a  
simple if/else statement with only two clauses. Those would still be  
able to have braces on only one of the two clauses. But if/else chains  
of more than two clauses would have to be consistent.

For anyone who agreed with my suggestion, you may want to consider  
whether you still agree in light of this clarification.

Regards,
Maciej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20091203/256b0588/attachment-0001.html>


More information about the webkit-dev mailing list