stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Lemings" <>
Subject RE: spacing suggestion for new code
Date Thu, 26 Jun 2008 23:55:10 GMT

> -----Original Message-----
> From: Martin Sebor [] On Behalf Of Martin Sebor
> Sent: Thursday, June 26, 2008 5:21 PM
> To:
> Subject: spacing suggestion for new code
> While reviewing all the new code that's been added I'm finding it
> difficult to spot where one namespace-scope definition ends and
> another starts because the spacing between them (the number of
> newlines) is the same as the spacing between members, namely 1
> blank line. I find code easier to read when namespace scope
> definitions of functions and classes that span more than one
> line are separated by two blank lines.
> Existing code likely isn't completely consistent in this regard,
> and I'm sure examples of both styles could be found, but I'd like
> to think the two-line style is prevalent. Either way, in the
> interest of readability, I'd like to suggest that we adopt the
> two-line spacing style for all new code. Yes?

That's my general preference as well.  I prefer to use two lines to
separate unrelated logical groups.  If the groups are related, I'll use
1 line to separate them.  Within a logical group, I do not use any blank

In the case of namespaces, I'd use 2 blank lines to separate the
namespace from its non-namespace members though I would use only 1 blank
line to separate the namespace from nested namespaces.

	namespace A {

	namespace B {

	class T;

	} // namespace B

	enum { E = 1 };

	} // namespace A


View raw message