Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 67109 invoked from network); 16 Apr 2008 21:33:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Apr 2008 21:33:31 -0000 Received: (qmail 82314 invoked by uid 500); 16 Apr 2008 21:33:31 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 82302 invoked by uid 500); 16 Apr 2008 21:33:31 -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 82293 invoked by uid 99); 16 Apr 2008 21:33:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2008 14:33:31 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.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; Wed, 16 Apr 2008 21:32:41 +0000 Received: from exchmail01.Blue.Roguewave.Com (exchmail01.blue.roguewave.com [10.22.129.22]) by moroha.roguewave.com (8.13.6/8.13.6) with ESMTP id m3GLX0ak003455 for ; Wed, 16 Apr 2008 21:33:00 GMT X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: RE: Another style question Date: Wed, 16 Apr 2008 15:32:51 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Another style question Thread-Index: Acif+V7IMD7KtcfAQouCJVrG/b+93gADuftA References: <48064646.8040806@roguewave.com> <48065548.2090507@roguewave.com> From: "Eric Lemings" To: X-Virus-Checked: Checked by ClamAV on apache.org =20 Another related question, not so much style-based though. Why the parentheses around preprocessing symbols in an `#if defined (FOO)` directive but not in an `#ifdef FOO` directive? Example: $ grep -n "^#if" $SVNROOT/trunk/src/exception.cpp ... src/exception.cpp:303:#ifdef _RWSTD_NO_EXCEPTION_COPY_CTOR src/exception.cpp:307:#if defined (__INTEL_COMPILER) ... For that matter, why use parentheses in a if-def at all? Brad. > -----Original Message----- > From: Martin Sebor [mailto:msebor@gmail.com] On Behalf Of Martin Sebor > Sent: Wednesday, April 16, 2008 1:37 PM > To: dev@stdcxx.apache.org > Subject: Re: Another style question >=20 > Eric Lemings wrote: > > =20 > [...] > >> Btw., a more flexible way to code these workarounds would have been > >> to code it like so: > >> > >> #if !_RWSTD_NO_MEMBER_TEMPLATES > >> // correct code > >> #else > >> // workaround > >> #endif > >> > >> This way, each config macro could be #defined on the command line > >> to 0 or 1 to toggle either branch (e.g., for testing and=20 > debugging). > >> That's not possible with the #ifndef approach. > >=20 > > From a natural language perspective, I've always found the double > > negatives (e.g. `#ifndef _RWSTD_NO_FOO) a bit irritating but that's > > just me. >=20 > I don't like it either but I think it has two important advantages > over the alternative (e.g., the GNU HAVE_FOO style). First, in a 100% > conforming environment our convention makes it, at least in theory, > possible to compile the library without having to configure it, > while the other always requires the config tests, or will produce > a badly crippled library when none of the config macros is defined. > Second, our approach will end up with fewer #defined macros than > the other strategy. >=20 > Martin >=20