[webkit-dev] unwritten rules of webkit style
darin at apple.com
Wed Sep 2 10:00:18 PDT 2009
On Sep 2, 2009, at 9:46 AM, Peter Kasting wrote:
> On Wed, Sep 2, 2009 at 8:40 AM, David Levin <levin at chromium.org>
> There should be a single space after punctation and before the next
> 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.
We did standardize on one space for both of these years ago. But this
rule is one that people often forget and that a few others disagree
with and disobey intentionally.
> 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)
> 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)
> I don't believe I've seen cases like the one you give.
The style where the && and the statement have the same indentation
doesn’t work well. David is correct that I recommend and use the extra
indenting level, and have included it in new code added to this
project for years. We may not have consensus on this, though. Some
people still put the operators on the ends of lines, in fact.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev