[webkit-dev] namespace indent

Jens Alfke snej at chromium.org
Thu Dec 3 14:22:43 PST 2009


Should the namespace-indent rule apply even to nested namespaces? I  
understand the reasoning behind the rule — it's a waste of horizontal  
space to indent almost everything in the file — but if a secondary  
namespace is declared, it would seem weird not to indent its lines  
either.

This comes up because I have a patch out for review that includes the  
addition of an HTTPHeaders namespace that just contains a bunch of  
string constants:

// HTTPHeaderMap.h
namespace WebCore {

     class HTTPHeaderMap : public HashMap<AtomicString, String,  
CaseFoldingHash> {
	...
	...
     };

     namespace HTTPHeaders {
         extern const char* const Accept;
         extern const char* const Authorization;
         ...
         extern const char* const UserAgent;
     }
}

This would look strange if the contents of HTTPHeaders weren't  
indented. Especially since if HTTPHeaders were made a class instead  
(which I almost decided to do) the style guide _would_ say to indent it.

     namespace HTTPHeaders {
     extern const char* const Accept;
     extern const char* const Authorization;
     ...
     extern const char* const UserAgent;
     }

—Jens


More information about the webkit-dev mailing list