[webkit-dev] unwritten rules of webkit style

Geoffrey Garen ggaren at apple.com
Wed Sep 2 11:23:09 PDT 2009


> Comments should look like sentences by beginning with a capital and  
> ending with a period (punctation).

I think this is a generally good recommendation, but sometimes a  
sentence fragment makes for a better comment, e.g.:

if (x == y) // false for NaN

> Don't add explicit line breaks in the middle of a statement unless  
> it is severely illegible even at wide editor window width (which  
> current code tends to treats as about 120-180 characters).

Meh. We have a lot of code that breaks around "&&" and "||" operators,  
and I think it's OK.

> Additional clauses in a conditional may be indented 4 extra spaces  
> to visually separate them from the statement to be executed.
>
>
> Like this
> if (condition1
>         && condition2)
>     statement;

I think the majority of our code disagrees with this guideline. I  
disagree with it too. I would prefer the "&&" to be evenly indented  
with condition1, or the "&&" to be on the same line as condition1, and  
condition2 evenly indented with condition1.
>

Geoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090902/79affbf5/attachment.html>


More information about the webkit-dev mailing list