[webkit-dev] Some new coding style rules

Nikolas Zimmermann zimmermann at physik.rwth-aachen.de
Wed Aug 4 01:29:56 PDT 2010


Good morning WebKit crowd,

I'd like to discuss some style issues, that I'm frequently unsure about:

1. namespace closing brace
It was discussed in http://article.gmane.org/gmane.os.opendarwin.webkit.devel/10563 
, but with no real result.

When writing headers, do we need the "// namespace Foo" comment after  
the namespace closing brace? I think it's visual noise and would like  
to see a style rule that forbids it.
(A rule that says we need this would also be fine with me, as long as  
we write it down. But I'd vote for removing those comments, I don't  
trust them anyways, if I'm unsure.)

namespace WebCore {
...
} // namespace WebCore

2. ENABLE(FOO) #endif comments

#if ENABLE(FOO)
..
#endif // ENABLE(FOO)

Shall we remove the comment, or require it explicitely in the style  
rules?

3. Inclusion order

Say Foo.h is guarded with ENABLE(FOO) macros
Foo.h:
#if ENABLE(FOO)
namespace WebCore {

class Foo...

}
#endif

What's the correct inclusion order in Foo.cpp:
#include "config.h"
#include "Foo.h"

#if ENABLE(FOO)
..
#endif

or

#include "config.h"
#include "Foo.h"

#if ENABLE(FOO)
..
#endif

(I think the former, as it makes no sense to process the header, if I  
already know it's enclosed in ENABLE(FOO) blocks)

I'd be happy if we could agree on rules and write them down.

Cheers,
Niko



More information about the webkit-dev mailing list