From dev-return-8030-apmail-stdcxx-dev-archive=stdcxx.apache.org@stdcxx.apache.org Fri Jun 27 18:23:52 2008 Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 84523 invoked from network); 27 Jun 2008 18:23:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Jun 2008 18:23:52 -0000 Received: (qmail 319 invoked by uid 500); 27 Jun 2008 18:23:53 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 301 invoked by uid 500); 27 Jun 2008 18:23:53 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 290 invoked by uid 99); 27 Jun 2008 18:23:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jun 2008 11:23:53 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.roguewave.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jun 2008 18:23:03 +0000 Received: from nebula.bco.roguewave.com ([10.70.3.27]) by moroha.roguewave.com (8.13.6/8.13.6) with ESMTP id m5RINLgZ007723 for ; Fri, 27 Jun 2008 18:23:21 GMT Message-ID: <4865301A.6020906@roguewave.com> Date: Fri, 27 Jun 2008 12:23:22 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: spacing suggestion for new code References: <4864245A.1040805@roguewave.com> <486479A9.9080302@roguewave.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Travis Vitek wrote: > Martin Sebor wrote: > >> Eric Lemings wrote: >>> >>> >>>> -----Original Message----- >>>> From: Martin Sebor [mailto:msebor@gmail.com] On Behalf Of Martin Sebor >>>> Sent: Thursday, June 26, 2008 5:21 PM >>>> To: dev@stdcxx.apache.org >>>> 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 >>> lines. >> Your rule sounds a bit more complex than what I'm suggesting. >> Determining what logically belongs together requires an >> understanding of the definitions. What I'm looking for is >> a purely visual clue to help me tell one namespace-scope >> declarative region (mostly just class or function definition) >>from another. > > Should either scheme apply to linkage specifiers? You mean extern "C" or "C++" blocks? I think so. Syntactically, there's little difference between them and namespaces. > > Personally, I like the flexibility to use zero lines in some places... > > // i prefer this... > > _RWSTD_NAMESPACE(__rw) { ...and clearly also zero spaces before the open paren ;-) > struct __rw_whatever_type; > } // namespace __rw > > // as opposed to this... > > _RWSTD_NAMESPACE(__rw) { > > > struct __rw_whatever_type; > > > } // namespace __rw Now this would be just plain silly! ;-) The point of my suggestion is to help with the readability of adjacent definitions that span several lines of code. It seems obvious that the two blank lines don't make the code any easier to read than one. If __rw_whatever_type were a definition of the type spanning several lines, that would be a different story. That said, I find the style you show above a bit too compact. I'd hope for a pair of blank lines around the declaration of the struct, even with a comment above the declaration. Martin > > As long as the number of lines of whitespace doesn't outnumber the number of lines of 'code', I'm fine with using multiple lines of whitspace. Other than that, I don't really have a preference. > > Travis