220 9482 <CAB+4KHLc+XK-s2f6nxZPq--VbpFir0k6WenEmXE2EgX0C_x0WA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Andrew Tomazos <andrewtomazos@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: #requre "header.h"
Date: Sat, 1 Mar 2014 17:03:52 +0100
Lines: 164
Approved: news@gmane.org
Message-ID: <CAB+4KHLc+XK-s2f6nxZPq--VbpFir0k6WenEmXE2EgX0C_x0WA@mail.gmail.com>
References: <5311f640.426b440a.3b13.ffff8533@mx.google.com>
	<e6be6b1f-6620-49a0-b53a-336e0a7f76e1@isocpp.org>
	<CAGNvRgAggc5fq6tma6_AyZi2Y+qWR0sDbqa7W-=gD2xDTNscrA@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=f46d041703f36432e904f38db3ed
X-Trace: ger.gmane.org 1393689825 22462 80.91.229.3 (1 Mar 2014 16:03:45 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 1 Mar 2014 16:03:45 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBD5KHQXXWYPRB2MJZCMAKGQE4O5MVJA@isocpp.org Sat Mar 01 17:03:54 2014
Return-path: <std-proposals+bncBD5KHQXXWYPRB2MJZCMAKGQE4O5MVJA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-la0-f72.google.com ([209.85.215.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBD5KHQXXWYPRB2MJZCMAKGQE4O5MVJA@isocpp.org>)
	id 1WJmOI-0005Do-9z
	for gclcip-std-proposals@m.gmane.org; Sat, 01 Mar 2014 17:03:54 +0100
Original-Received: by mail-la0-f72.google.com with SMTP id gl10sf8548984lab.11
        for <gclcip-std-proposals@m.gmane.org>; Sat, 01 Mar 2014 08:03:54 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=p63/85GjUitTTGLFY8bD8uOl8Sk6cQWGCGqvcJXc7sY=;
        b=MlC8oSz5u8Z53RHnbA+QVuqp64J5RI4UXPpRKzrR0mabmW0ygayS+9KwebjUsNIQp1
         qdvrEL7rGf88YMo/HLVueNWmAK/YkEAm0mwRh4XI1zhove25vDKRXaGQVBdLzE3qJwaI
         pVcpzTX0m+SKkixY7im/nGYcwrdbGtUxrtvXVH2LfyfjwY8PhmgQpd6dSjj4D4L9aDwq
         Cw3gABwSPPqtDPkwG0N/hmfIR04Hs3SZvFoKkAjUlfa1lbBXYb4PN10GEnfkLm2FzoOv
         5vVZP92QEDnOzJWx/gyPliWjKNuvJkpu5CN6Uak+h+tlDarNIMzcwE52QCh/QiVJ1NJG
         IR1Q==
X-Gm-Message-State: ALoCoQmaR/Zzkja9+X7lIgx5TiyJREGoi91D7tHXeypC6fsl/SSif+MM5dB5N+rxD0elZTFuASUr
X-Received: by 10.152.45.105 with SMTP id l9mr10199724lam.5.1393689833829;
        Sat, 01 Mar 2014 08:03:53 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.96.193 with SMTP id du1ls246261wib.28.gmail; Sat, 01 Mar
 2014 08:03:52 -0800 (PST)
X-Received: by 10.14.175.129 with SMTP id z1mr364186eel.97.1393689832757;
        Sat, 01 Mar 2014 08:03:52 -0800 (PST)
Original-Received: from mail-ee0-x22f.google.com (mail-ee0-x22f.google.com [2a00:1450:4013:c00::22f])
        by mx.google.com with ESMTPS id t3si6326473eeg.64.2014.03.01.08.03.52
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 01 Mar 2014 08:03:52 -0800 (PST)
Received-SPF: pass (google.com: domain of andrewtomazos@gmail.com designates 2a00:1450:4013:c00::22f as permitted sender) client-ip=2a00:1450:4013:c00::22f;
Original-Received: by mail-ee0-f47.google.com with SMTP id b15so205650eek.34
        for <std-proposals@isocpp.org>; Sat, 01 Mar 2014 08:03:52 -0800 (PST)
X-Received: by 10.205.99.1 with SMTP id cq1mr5191099bkc.5.1393689832456; Sat,
 01 Mar 2014 08:03:52 -0800 (PST)
Original-Received: by 10.205.9.197 with HTTP; Sat, 1 Mar 2014 08:03:52 -0800 (PST)
In-Reply-To: <CAGNvRgAggc5fq6tma6_AyZi2Y+qWR0sDbqa7W-=gD2xDTNscrA@mail.gmail.com>
X-Original-Sender: andrewtomazos@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of andrewtomazos@gmail.com designates 2a00:1450:4013:c00::22f as
 permitted sender) smtp.mail=andrewtomazos@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:9482
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/9482>

--f46d041703f36432e904f38db3ed
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Yes, NDEBUG is kind of disappointing:

Standard headers may be included in any order; each may be included more
than once in
a given scope, with no effect different from being included only once,
except that the
effect of including <assert.h> depends on the de=EF=AC=81nition of NDEBUG (=
see 7.2)

The header <assert.h> de=EF=AC=81nes the assert macro and refers to another=
 macro,

   NDEBUG

which is not de=EF=AC=81ned by <assert.h>. If NDEBUG is de=EF=AC=81ned as a=
 macro name at
the
point in the source =EF=AC=81le where <assert.h> is included, the assert ma=
cro is
de=EF=AC=81ned
simply as

   #define assert(ignore) ((void)0)

The assert macro is rede=EF=AC=81ned according to the current state of NDEB=
UG each
time that
<assert.h> is included.

So assert.h is implemented like:

// no header guard
#ifdef NDEBUG

    #undef assert
    #define assert(ignore) ((void)0)

#else

    #undef assert
    #define assert(x) (__real_assert_def(x))

#endif

I'm sure the people working in modules enjoy talking about these 7 lines of
code. :)



On Sat, Mar 1, 2014 at 4:34 PM, Daniel Kr=C3=BCgler <daniel.kruegler@gmail.=
com>wrote:

> 2014-03-01 16:33 GMT+01:00 Andrew Tomazos <andrewtomazos@gmail.com>:
> > What are some examples of header files that are designed for multiple
> > inclusion?
>
> <assert.h> and <cassert> come to my mind.
>
> - Daniel
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--f46d041703f36432e904f38db3ed
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Yes, NDEBUG is kind of disappointing:</div><div><br><=
/div><div>Standard headers may be included in any order; each may be includ=
ed more than once in</div><div>a given scope, with no effect different from=
 being included only once, except that the</div>
<div>effect of including &lt;assert.h&gt; depends on the de=EF=AC=81nition =
of NDEBUG (see 7.2)</div><div><br></div><div><div>The header &lt;assert.h&g=
t; de=EF=AC=81nes the assert macro and refers to another macro,</div><div><=
br></div><div>
=C2=A0 =C2=A0NDEBUG</div><div><br></div><div>which is not de=EF=AC=81ned by=
 &lt;assert.h&gt;. If NDEBUG is de=EF=AC=81ned as a macro name at the</div>=
<div>point in the source =EF=AC=81le where &lt;assert.h&gt; is included, th=
e assert macro is de=EF=AC=81ned</div>
<div>simply as</div><div><br></div><div>=C2=A0 =C2=A0#define assert(ignore)=
 ((void)0)</div><div><br></div><div>The assert macro is rede=EF=AC=81ned ac=
cording to the current state of NDEBUG each time that</div><div>&lt;assert.=
h&gt; is included.</div>
<div><br></div></div><div>So assert.h is implemented like:</div><div><br></=
div><div>// no header guard</div><div>#ifdef NDEBUG</div><div><br></div><di=
v><div>=C2=A0 =C2=A0 #undef assert</div><div>=C2=A0 =C2=A0 #define assert(i=
gnore) ((void)0)</div>
</div><div><br></div><div>#else</div><div><div><br></div><div>=C2=A0 =C2=A0=
 #undef assert</div><div>=C2=A0 =C2=A0 #define assert(x) (__real_assert_def=
(x))</div></div><div><br></div><div>#endif</div><div><br></div><div>I&#39;m=
 sure the people working in modules enjoy talking about these 7 lines of co=
de. :)</div>
<div><br></div></div><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On Sat, Mar 1, 2014 at 4:34 PM, Daniel Kr=C3=BCgler <span dir=3D"lt=
r">&lt;<a href=3D"mailto:daniel.kruegler@gmail.com" target=3D"_blank">danie=
l.kruegler@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">2014-03-01 16:33 GMT+01:00 Andrew Tomazos &l=
t;<a href=3D"mailto:andrewtomazos@gmail.com">andrewtomazos@gmail.com</a>&gt=
;:<br>

<div class=3D"">&gt; What are some examples of header files that are design=
ed for multiple<br>
&gt; inclusion?<br>
<br>
</div>&lt;assert.h&gt; and &lt;cassert&gt; come to my mind.<br>
<span class=3D"HOEnZb"><font color=3D"#888888"><br>
- Daniel<br>
</font></span><div class=3D"HOEnZb"><div class=3D"h5"><br>
--<br>
<br>
---<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--f46d041703f36432e904f38db3ed--

.
