Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 30949 invoked from network); 23 Jun 2008 05:04:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Jun 2008 05:04:13 -0000 Received: (qmail 43168 invoked by uid 500); 23 Jun 2008 05:04:14 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 43151 invoked by uid 500); 23 Jun 2008 05:04:14 -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 43140 invoked by uid 99); 23 Jun 2008 05:04:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Jun 2008 22:04:14 -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; Mon, 23 Jun 2008 05:03:25 +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 m5N53gEu030597 for ; Mon, 23 Jun 2008 05:03:42 GMT X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C8D4EE.6FB09F49" Subject: RE: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: <485ED79C.1080605@roguewave.com> From: "Travis Vitek" To: X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01C8D4EE.6FB09F49 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Martin Sebor wrote: >Eric Lemings wrote: >> Consider the following: >> =20 >> file $TOPDIR/include/memory: >> ... >> 30 #ifndef _RWSTD_MEMORY_INCLUDED >> 31 #define _RWSTD_MEMORY_INCLUDED >> 32 >> 33 #include >> 34 #include >> 35 #include >> 36 #include >> 37 #include >> 38 #include >> 39 #include >> 40 >> 41 #endif // _RWSTD_MEMORY_INCLUDED >>=20 >> Any idea why is included last? I've noticed this in a >> couple other standard headers also. > >As opposed to being first, or in the middle? What would be the >rationale? > >The (undocumented) style for #include directives in stdcxx goes >something like this: > >In all library headers: > >1. standard headers (C++, including stdcxx own, C, or POSIX are > never included (there are a shrinking number of exceptions to > this rule) So, as an example, if one of us needed to use = std::integral_constant in some header, the definition of that type = would need to be moved to some private header and included from both = places to avoid including . I can buy this as it fits with = the unnecessary namespace polution problem that keeps coming up. > >2. include directives are in alphabetical order, with rw/_defs.h > being last (it still ends up getting included first, indirectly, > by the first header); the exception here is when a stdcxx config > macro needs to be tested before the first #include directive Okay, and what is the rationale for including rw/_defs.h last? If it = provides defines that are needed by the current file, why not just put = it in the list in alphabetical order like the others? > >3. each #include directive in every standard header is guarded with > a preprocessor conditional testing the XXX_INCLUDED macro for > the corresponding header for compile-time efficiency > I'm assuming that you're talking about this kind of thing... #ifndef _RWSTD_RW_ALGOBASE_H_INCLUDED # include #endif // _RWSTD_RW_ALGOBASE_H_INCLUDED #ifndef _RWSTD_RW_ITERBASE_H_INCLUDED # include #endif // _RWSTD_RW_ITERBASE_H_INCLUDED I looked in a handful of standard headers and didn't see this model = anywhere. I do see it in many of the private headers, but it is not = being used consistently. Do we have any evidence that shows this 'optimization' is actually = improving compile times? >In library sources: > >1. sets of C++, C, POSIX, and stdcxx-private headers are included > in separate blocks of their own, in alphabetical order within > each block >2. C headers are included using the xxx.h form (as opposed to the > cxxx form) for better portability > >Martin ------_=_NextPart_001_01C8D4EE.6FB09F49--