[webkit-dev] unwritten rules of webkit style

Peter Kasting pkasting at google.com
Wed Sep 2 09:46:20 PDT 2009


On Wed, Sep 2, 2009 at 8:40 AM, David Levin <levin at chromium.org> wrote:

> *Comments
> * There should be a *single* space after punctation and before the next
> sentence.
>
> There should only be a single space before end of line comments.
>

I don't think either of these are unwritten rules.  Both (especially the
second) are frequently seen with two spaces.  I frequently see "close of #if
or namespace" EOL comments with one space before //, and other EOL comments
with two.  I wouldn't mind standardizing (my preference is two spaces) but
I'm not sure we can yet.

*Indentation*
> 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 note you used "may" instead of "should" or "must".  It seems like we
should pick the right thing and say "must".  My reading of the current style
guide is that the current recommended indentation for this case is:
if (long_condition1
    && long_condition2
    && long_condition3)
    statement;

I don't believe I've seen cases like the one you give.

*Misc*
> Files who should end with newlines.
>

s/who//.  In fact it might be clearer to say "Files should end with a
trailing newline".

PK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090902/5bc10782/attachment.html>


More information about the webkit-dev mailing list