Topic: #requre "header.h


Author: arvabalazs@gmail.com
Date: Sat, 1 Mar 2014 06:41:58 -0800 (PST)
Raw View
------=_Part_67_18708646.1393684918724
Content-Type: text/plain; charset=UTF-8

Hi all,

I am very interested in your opinion about this idea. Currently every
header file in the world contains a #pragma once or a header guard except
some extraordinary stuff related to preprocessor programming.
My proposal is that we should add a new preprocessor directive: #require
(the wording can be better, I am open for any ideas). The behavior is
basically same as #include but it automatically includes header files (or
any type of file) only once.

Refactoring your current code is very straightforward: change every
#include to #require and you can remove every #pragma once or header guard.
In short: you do the (almost) same but your code will be shorter, clearer
and less verbose without breaking any old code.

Is it possible to implement in existing preprocessors (at experimental
stage it can be #pragma require("header.h"))? Is this worth a proposal for
the C++ committee?

--

---
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/.

------=_Part_67_18708646.1393684918724
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span style=3D"color: rgb(0, 0, 0); font-family: verdana, =
arial, helvetica, sans-serif; font-size: small; background-color: rgb(250, =
250, 250);">Hi all,</span><div><span style=3D"color: rgb(0, 0, 0); font-fam=
ily: verdana, arial, helvetica, sans-serif; font-size: small; background-co=
lor: rgb(250, 250, 250);"><br></span></div><div><span style=3D"color: rgb(0=
, 0, 0); font-family: verdana, arial, helvetica, sans-serif; font-size: sma=
ll; background-color: rgb(250, 250, 250);">I am very interested in your opi=
nion about this idea. Currently every header file in the world contains a #=
pragma once or a header guard except some extraordinary stuff related to pr=
eprocessor programming.</span></div><div><span style=3D"color: rgb(0, 0, 0)=
; font-family: verdana, arial, helvetica, sans-serif; font-size: small; bac=
kground-color: rgb(250, 250, 250);">My proposal is that we should add a new=
 preprocessor directive: #require (the wording can be better, I am open for=
 any ideas). The behavior is basically same as #include but it automaticall=
y includes header files (or any type of file) only once.</span></div><div><=
span style=3D"color: rgb(0, 0, 0); font-family: verdana, arial, helvetica, =
sans-serif; font-size: small; background-color: rgb(250, 250, 250);"><br></=
span></div><div><span style=3D"color: rgb(0, 0, 0); font-family: verdana, a=
rial, helvetica, sans-serif; font-size: small; background-color: rgb(250, 2=
50, 250);">Refactoring your current code is very straightforward: change ev=
ery #include to #require and you can remove every #pragma once or header gu=
ard. In short: you do the (almost) same but your code will be shorter, clea=
rer and less verbose without breaking any old code.</span></div><div><span =
style=3D"color: rgb(0, 0, 0); font-family: verdana, arial, helvetica, sans-=
serif; font-size: small; background-color: rgb(250, 250, 250);"><br></span>=
</div><div><span style=3D"color: rgb(0, 0, 0); font-family: verdana, arial,=
 helvetica, sans-serif; font-size: small; background-color: rgb(250, 250, 2=
50);">Is it possible to implement in existing preprocessors (at experimenta=
l stage it can be #pragma require("header.h"))? Is this worth a proposal fo=
r the C++ committee?</span></div></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 />

------=_Part_67_18708646.1393684918724--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Sat, 1 Mar 2014 16:44:35 +0200
Raw View
On 1 March 2014 16:41,  <arvabalazs@gmail.com> wrote:
> Hi all,
>
> I am very interested in your opinion about this idea. Currently every header
> file in the world contains a #pragma once or a header guard except some
> extraordinary stuff related to preprocessor programming.
> My proposal is that we should add a new preprocessor directive: #require
> (the wording can be better, I am open for any ideas). The behavior is
> basically same as #include but it automatically includes header files (or
> any type of file) only once.
>
> Refactoring your current code is very straightforward: change every #include
> to #require and you can remove every #pragma once or header guard. In short:
> you do the (almost) same but your code will be shorter, clearer and less
> verbose without breaking any old code.
>
> Is it possible to implement in existing preprocessors (at experimental stage
> it can be #pragma require("header.h"))? Is this worth a proposal for the C++
> committee?


It has been proposed before, and it never got through. Modules are usually
cited as a superior solution, and there is ongoing work to add them,
see http://isocpp.org/std/the-committee and SG2 under it.

--

---
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/.

.


Author: "=?utf-8?B?YmlsbHkub25lYWxAZ21haWwuY29t?=" <billy.oneal@gmail.com>
Date: Sat, 01 Mar 2014 07:01:19 -0800
Raw View
------=_Part_0_1393686079254
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

#pragma once is a superior solution anyway. Usually the author of the heade=
r file knows better than the user if the header is designed for multiple in=
clusion or not. Also, headers are often #include ed many times, so placing =
that information in one place (in the header) is better than placing that i=
nformation in many places (where everyone uses the header).

Sent from a touchscreen. Please excuse the brevity and tpyos.

----- Reply message -----
From: "Ville Voutilainen" <ville.voutilainen@gmail.com>
To: <std-proposals@isocpp.org>
Subject: [std-proposals] #requre "header.h"
Date: Sat, Mar 1, 2014 6:44 AM

On 1 March 2014 16:41,  <arvabalazs@gmail.com> wrote:
> Hi all,
>
> I am very interested in your opinion about this idea. Currently every hea=
der
> file in the world contains a #pragma once or a header guard except some
> extraordinary stuff related to preprocessor programming.
> My proposal is that we should add a new preprocessor directive: #require
> (the wording can be better, I am open for any ideas). The behavior is
> basically same as #include but it automatically includes header files (or
> any type of file) only once.
>
> Refactoring your current code is very straightforward: change every #incl=
ude
> to #require and you can remove every #pragma once or header guard. In sho=
rt:
> you do the (almost) same but your code will be shorter, clearer and less
> verbose without breaking any old code.
>
> Is it possible to implement in existing preprocessors (at experimental st=
age
> it can be #pragma require("header.h"))? Is this worth a proposal for the =
C++
> committee?


It has been proposed before, and it never got through. Modules are usually
cited as a superior solution, and there is ongoing work to add them,
see http://isocpp.org/std/the-committee and SG2 under it.

--=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/.

--=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/.

------=_Part_0_1393686079254
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/htm=
l4/strict.dtd">
<html><head></head><body><div style=3D"font-size: 12pt; font-family: Calibr=
i,sans-serif;"><div>#pragma once is a superior solution anyway. Usually the=
 author of the header file knows better than the user if the header is desi=
gned for multiple inclusion or not. Also, headers are often #include ed man=
y times, so placing that information in one place (in the header) is better=
 than placing that information in many places (where everyone uses the head=
er).</div><div><br></div><div>Sent from a touchscreen. Please excuse the br=
evity and tpyos.</div><br><div id=3D"htc_header">----- Reply message -----<=
br>From: &quot;Ville Voutilainen&quot; &lt;ville.voutilainen@gmail.com&gt;<=
br>To: &lt;std-proposals@isocpp.org&gt;<br>Subject: [std-proposals] #requre=
 &quot;header.h&quot;<br>Date: Sat, Mar 1, 2014 6:44 AM</div></div><br><pre=
 style=3D"word-wrap: break-word; white-space: pre-wrap;">On 1 March 2014 16=
:41,  &lt;arvabalazs@gmail.com&gt; wrote:
&gt; Hi all,
&gt;
&gt; I am very interested in your opinion about this idea. Currently every =
header
&gt; file in the world contains a #pragma once or a header guard except som=
e
&gt; extraordinary stuff related to preprocessor programming.
&gt; My proposal is that we should add a new preprocessor directive: #requi=
re
&gt; (the wording can be better, I am open for any ideas). The behavior is
&gt; basically same as #include but it automatically includes header files =
(or
&gt; any type of file) only once.
&gt;
&gt; Refactoring your current code is very straightforward: change every #i=
nclude
&gt; to #require and you can remove every #pragma once or header guard. In =
short:
&gt; you do the (almost) same but your code will be shorter, clearer and le=
ss
&gt; verbose without breaking any old code.
&gt;
&gt; Is it possible to implement in existing preprocessors (at experimental=
 stage
&gt; it can be #pragma require("header.h"))? Is this worth a proposal for t=
he C++
&gt; committee?


It has been proposed before, and it never got through. Modules are usually
cited as a superior solution, and there is ongoing work to add them,
see <a href=3D"http://isocpp.org/std/the-committee">http://isocpp.org/std/t=
he-committee</a> and SG2 under it.

--=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 <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/.">http://groups.google.com/a/isocpp.org/group/std-proposals/=
..</a>
</pre></body></html>

<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 />

------=_Part_0_1393686079254--


.


Author: Andrew Tomazos <andrewtomazos@gmail.com>
Date: Sat, 1 Mar 2014 07:33:35 -0800 (PST)
Raw View
------=_Part_906_10399355.1393688015622
Content-Type: text/plain; charset=UTF-8

What are some examples of header files that are designed for multiple
inclusion?

On Saturday, March 1, 2014 4:01:19 PM UTC+1, Billy O'Neal wrote:
>
> #pragma once is a superior solution anyway. Usually the author of the
> header file knows better than the user if the header is designed for
> multiple inclusion or not. Also, headers are often #include ed many times,
> so placing that information in one place (in the header) is better than
> placing that information in many places (where everyone uses the header).
>
> Sent from a touchscreen. Please excuse the brevity and tpyos.
>
> ----- Reply message -----
> From: "Ville Voutilainen" <ville.vo...@gmail.com <javascript:>>
> To: <std-pr...@isocpp.org <javascript:>>
> Subject: [std-proposals] #requre "header.h"
> Date: Sat, Mar 1, 2014 6:44 AM
>
> On 1 March 2014 16:41,  <arvab...@gmail.com <javascript:>> wrote:
> > Hi all,
> >
> > I am very interested in your opinion about this idea. Currently every header
> > file in the world contains a #pragma once or a header guard except some
> > extraordinary stuff related to preprocessor programming.
> > My proposal is that we should add a new preprocessor directive: #require
> > (the wording can be better, I am open for any ideas). The behavior is
> > basically same as #include but it automatically includes header files (or
> > any type of file) only once.
> >
> > Refactoring your current code is very straightforward: change every #include
> > to #require and you can remove every #pragma once or header guard. In short:
> > you do the (almost) same but your code will be shorter, clearer and less
> > verbose without breaking any old code.
> >
> > Is it possible to implement in existing preprocessors (at experimental stage
> > it can be #pragma require("header.h"))? Is this worth a proposal for the C++
> > committee?
>
>
> It has been proposed before, and it never got through. Modules are usually
> cited as a superior solution, and there is ongoing work to add them,
> see http://isocpp.org/std/the-committee and SG2 under it.
>
> --
>
> ---
> 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-proposal...@isocpp.org <javascript:>.
> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
> Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
>
>

--

---
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/.

------=_Part_906_10399355.1393688015622
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">What are some examples of header files that are designed f=
or multiple inclusion?<div><br><div>On Saturday, March 1, 2014 4:01:19 PM U=
TC+1, Billy O'Neal wrote:<blockquote class=3D"gmail_quote" style=3D"margin:=
 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div><div style=3D"font-size:12pt;font-family:Calibri,sans-serif"><div>#pra=
gma once is a superior solution anyway. Usually the author of the header fi=
le knows better than the user if the header is designed for multiple inclus=
ion or not. Also, headers are often #include ed many times, so placing that=
 information in one place (in the header) is better than placing that infor=
mation in many places (where everyone uses the header).</div><div><br></div=
><div>Sent from a touchscreen. Please excuse the brevity and tpyos.</div><b=
r><div>----- Reply message -----<br>From: "Ville Voutilainen" &lt;<a href=
=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"kxhDnM1VFsYJ" o=
nmousedown=3D"this.href=3D'javascript:';return true;" onclick=3D"this.href=
=3D'javascript:';return true;">ville.vo...@gmail.com</a>&gt;<br>To: &lt;<a =
href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"kxhDnM1VFsY=
J" onmousedown=3D"this.href=3D'javascript:';return true;" onclick=3D"this.h=
ref=3D'javascript:';return true;">std-pr...@isocpp.org</a>&gt;<br>Subject: =
[std-proposals] #requre "header.h"<br>Date: Sat, Mar 1, 2014 6:44 AM</div><=
/div><br><pre style=3D"word-wrap:break-word;white-space:pre-wrap">On 1 Marc=
h 2014 16:41,  &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated=
-mailto=3D"kxhDnM1VFsYJ" onmousedown=3D"this.href=3D'javascript:';return tr=
ue;" onclick=3D"this.href=3D'javascript:';return true;">arvab...@gmail.com<=
/a>&gt; wrote:
&gt; Hi all,
&gt;
&gt; I am very interested in your opinion about this idea. Currently every =
header
&gt; file in the world contains a #pragma once or a header guard except som=
e
&gt; extraordinary stuff related to preprocessor programming.
&gt; My proposal is that we should add a new preprocessor directive: #requi=
re
&gt; (the wording can be better, I am open for any ideas). The behavior is
&gt; basically same as #include but it automatically includes header files =
(or
&gt; any type of file) only once.
&gt;
&gt; Refactoring your current code is very straightforward: change every #i=
nclude
&gt; to #require and you can remove every #pragma once or header guard. In =
short:
&gt; you do the (almost) same but your code will be shorter, clearer and le=
ss
&gt; verbose without breaking any old code.
&gt;
&gt; Is it possible to implement in existing preprocessors (at experimental=
 stage
&gt; it can be #pragma require("header.h"))? Is this worth a proposal for t=
he C++
&gt; committee?


It has been proposed before, and it never got through. Modules are usually
cited as a superior solution, and there is ongoing work to add them,
see <a href=3D"http://isocpp.org/std/the-committee" target=3D"_blank" onmou=
sedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fisocpp.or=
g%2Fstd%2Fthe-committee\46sa\75D\46sntz\0751\46usg\75AFQjCNGhwbbuu87Xya0OOu=
Rq3nDs0MGZ_Q';return true;" onclick=3D"this.href=3D'http://www.google.com/u=
rl?q\75http%3A%2F%2Fisocpp.org%2Fstd%2Fthe-committee\46sa\75D\46sntz\0751\4=
6usg\75AFQjCNGhwbbuu87Xya0OOuRq3nDs0MGZ_Q';return true;">http://isocpp.org/=
std/the-<wbr>committee</a> and SG2 under it.

--=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 <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
kxhDnM1VFsYJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclic=
k=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr>isocpp.or=
g</a>.
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"kxhDnM1VFsYJ" onmousedown=3D"this.href=3D'java=
script:';return true;" onclick=3D"this.href=3D'javascript:';return true;">s=
td-pr...@isocpp.org</a>.
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/." target=3D"_blank" onmousedown=3D"this.href=3D'http://group=
s.google.com/a/isocpp.org/group/std-proposals/.';return true;" onclick=3D"t=
his.href=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/.';re=
turn true;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>propo=
sals/.</a>
</pre></div></blockquote></div></div></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 />

------=_Part_906_10399355.1393688015622--

.


Author: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@gmail.com>
Date: Sat, 1 Mar 2014 16:34:55 +0100
Raw View
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/.

.


Author: Andrew Tomazos <andrewtomazos@gmail.com>
Date: Sat, 1 Mar 2014 17:03:52 +0100
Raw View
--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--

.


Author: David Krauss <potswa@gmail.com>
Date: Sun, 2 Mar 2014 00:12:29 +0800
Raw View
--Apple-Mail=_D49FE614-166D-420C-9CCA-AA095E807E12
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1


On Mar 1, 2014, at 10:41 PM, arvabalazs@gmail.com wrote:

> My proposal is that we should add a new preprocessor directive: #require =
(the wording can be better, I am open for any ideas). The behavior is basic=
ally same as #include but it automatically includes header files (or any ty=
pe of file) only once.

This is occasionally implemented as #import. See the GCC preprocessor manua=
l for details, and why GNU considers it to be a poor solution. (IIRC, even =
if you document that the user is supposed to use #import, someone is still =
going to do #include and then you need the header guard -- nothing gained.)

--=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/.

--Apple-Mail=_D49FE614-166D-420C-9CCA-AA095E807E12
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 1=
, 2014, at 10:41 PM, <a href=3D"mailto:arvabalazs@gmail.com">arvabalazs@gma=
il.com</a> wrote:</div><br class=3D"Apple-interchange-newline"><blockquote =
type=3D"cite"><div dir=3D"ltr"><div><span style=3D"font-family: verdana, ar=
ial, helvetica, sans-serif; font-size: small; background-color: rgb(250, 25=
0, 250);">My proposal is that we should add a new preprocessor directive: #=
require (the wording can be better, I am open for any ideas). The behavior =
is basically same as #include but it automatically includes header files (o=
r any type of file) only once.</span></div></div></blockquote><br></div><di=
v>This is occasionally implemented as <font face=3D"Courier">#import</font>=
.. See the&nbsp;<a href=3D"http://gcc.gnu.org/onlinedocs/cpp.pdf%E2%80%8E">G=
CC preprocessor manual</a>&nbsp;for details, and why GNU considers it to be=
 a poor solution. (IIRC, even if you document that the user is supposed to =
use&nbsp;<font face=3D"Courier">#import</font>, someone is still going to d=
o&nbsp;<font face=3D"Courier">#include</font>&nbsp;and then you need the he=
ader guard &mdash; nothing gained.)</div><div><br></div></body></html>

<p></p>

-- <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+unsubscribe@isocpp.org">std-proposa=
ls+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/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_D49FE614-166D-420C-9CCA-AA095E807E12--

.


Author: "=?utf-8?B?YmlsbHkub25lYWxAZ21haWwuY29t?=" <billy.oneal@gmail.com>
Date: Sat, 01 Mar 2014 09:58:51 -0800
Raw View
------=_Part_0_1393696731170
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I think Boost.PP has some examples but I'm not sure.

Sent from a touchscreen. Please excuse the brevity and tpyos.

----- Reply message -----
From: "Andrew Tomazos" <andrewtomazos@gmail.com>
To: <std-proposals@isocpp.org>
Subject: [std-proposals] #requre "header.h"
Date: Sat, Mar 1, 2014 7:33 AM

What are some examples of header files that are designed for multiple inclu=
sion?
On Saturday, March 1, 2014 4:01:19 PM UTC+1, Billy O'Neal wrote:
#pragma once is a superior solution anyway. Usually the author of the heade=
r file knows better than the user if the header is designed for multiple in=
clusion or not. Also, headers are often #include ed many times, so placing =
that information in one place (in the header) is better than placing that i=
nformation in many places (where everyone uses the header).

Sent from a touchscreen. Please excuse the brevity and tpyos.

----- Reply message -----
From: "Ville Voutilainen" <ville.vo...@gmail.com>
To: <std-pr...@isocpp.org>
Subject: [std-proposals] #requre "header.h"
Date: Sat, Mar 1, 2014 6:44 AM

On 1 March 2014 16:41,  <arvab...@gmail.com> wrote:
> Hi all,
>
> I am very interested in your opinion about this idea. Currently every hea=
der
> file in the world contains a #pragma once or a header guard except some
> extraordinary stuff related to preprocessor programming.
> My proposal is that we should add a new preprocessor directive: #require
> (the wording can be better, I am open for any ideas). The behavior is
> basically same as #include but it automatically includes header files (or
> any type of file) only once.
>
> Refactoring your current code is very straightforward: change every #incl=
ude
> to #require and you can remove every #pragma once or header guard. In sho=
rt:
> you do the (almost) same but your code will be shorter, clearer and less
> verbose without breaking any old code.
>
> Is it possible to implement in existing preprocessors (at experimental st=
age
> it can be #pragma require("header.h"))? Is this worth a proposal for the =
C++
> committee?


It has been proposed before, and it never got through. Modules are usually
cited as a superior solution, and there is ongoing work to add them,
see http://isocpp.org/std/the-committee and SG2 under it.

--=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-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.







--=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/.

--=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/.

------=_Part_0_1393696731170
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<div style=3D"font-size: 12pt; font-family: Calibri,sans-serif;"><div>I thi=
nk Boost.PP has some examples but I'm not sure.</div><div><br></div><div>Se=
nt from a touchscreen. Please excuse the brevity and tpyos.</div><br><div i=
d=3D"htc_header">----- Reply message -----<br>From: &quot;Andrew Tomazos&qu=
ot; &lt;andrewtomazos@gmail.com&gt;<br>To: &lt;std-proposals@isocpp.org&gt;=
<br>Subject: [std-proposals] #requre &quot;header.h&quot;<br>Date: Sat, Mar=
 1, 2014 7:33 AM</div></div><br><div dir=3D"ltr">What are some examples of =
header files that are designed for multiple inclusion?<div><br><div>On Satu=
rday, March 1, 2014 4:01:19 PM UTC+1, Billy O'Neal wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;">
<div><div style=3D"font-size:12pt;font-family:Calibri,sans-serif"><div>#pra=
gma once is a superior solution anyway. Usually the author of the header fi=
le knows better than the user if the header is designed for multiple inclus=
ion or not. Also, headers are often #include ed many times, so placing that=
 information in one place (in the header) is better than placing that infor=
mation in many places (where everyone uses the header).</div><div><br></div=
><div>Sent from a touchscreen. Please excuse the brevity and tpyos.</div><b=
r><div>----- Reply message -----<br>From: "Ville Voutilainen" &lt;<a href=
=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"kxhDnM1VFsYJ" o=
nmousedown=3D"this.href=3D'javascript:';return true;" onclick=3D"this.href=
=3D'javascript:';return true;">ville.vo...@gmail.com</a>&gt;<br>To: &lt;<a =
href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"kxhDnM1VFsY=
J" onmousedown=3D"this.href=3D'javascript:';return true;" onclick=3D"this.h=
ref=3D'javascript:';return true;">std-pr...@isocpp.org</a>&gt;<br>Subject: =
[std-proposals] #requre "header.h"<br>Date: Sat, Mar 1, 2014 6:44 AM</div><=
/div><br><pre style=3D"word-wrap:break-word;white-space:pre-wrap">On 1 Marc=
h 2014 16:41,  &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated=
-mailto=3D"kxhDnM1VFsYJ" onmousedown=3D"this.href=3D'javascript:';return tr=
ue;" onclick=3D"this.href=3D'javascript:';return true;">arvab...@gmail.com<=
/a>&gt; wrote:
&gt; Hi all,
&gt;
&gt; I am very interested in your opinion about this idea. Currently every =
header
&gt; file in the world contains a #pragma once or a header guard except som=
e
&gt; extraordinary stuff related to preprocessor programming.
&gt; My proposal is that we should add a new preprocessor directive: #requi=
re
&gt; (the wording can be better, I am open for any ideas). The behavior is
&gt; basically same as #include but it automatically includes header files =
(or
&gt; any type of file) only once.
&gt;
&gt; Refactoring your current code is very straightforward: change every #i=
nclude
&gt; to #require and you can remove every #pragma once or header guard. In =
short:
&gt; you do the (almost) same but your code will be shorter, clearer and le=
ss
&gt; verbose without breaking any old code.
&gt;
&gt; Is it possible to implement in existing preprocessors (at experimental=
 stage
&gt; it can be #pragma require("header.h"))? Is this worth a proposal for t=
he C++
&gt; committee?


It has been proposed before, and it never got through. Modules are usually
cited as a superior solution, and there is ongoing work to add them,
see <a href=3D"http://isocpp.org/std/the-committee" target=3D"_blank" onmou=
sedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fisocpp.or=
g%2Fstd%2Fthe-committee\46sa\75D\46sntz\0751\46usg\75AFQjCNGhwbbuu87Xya0OOu=
Rq3nDs0MGZ_Q';return true;" onclick=3D"this.href=3D'http://www.google.com/u=
rl?q\75http%3A%2F%2Fisocpp.org%2Fstd%2Fthe-committee\46sa\75D\46sntz\0751\4=
6usg\75AFQjCNGhwbbuu87Xya0OOuRq3nDs0MGZ_Q';return true;">http://isocpp.org/=
std/the-<wbr>committee</a> and SG2 under it.

--=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 <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
kxhDnM1VFsYJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclic=
k=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr>isocpp.or=
g</a>.
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"kxhDnM1VFsYJ" onmousedown=3D"this.href=3D'java=
script:';return true;" onclick=3D"this.href=3D'javascript:';return true;">s=
td-pr...@isocpp.org</a>.
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/." target=3D"_blank" onmousedown=3D"this.href=3D'http://group=
s.google.com/a/isocpp.org/group/std-proposals/.';return true;" onclick=3D"t=
his.href=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/.';re=
turn true;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>propo=
sals/.</a>
</pre></div></blockquote></div></div></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 />

<p></p>

-- <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+unsubscribe@isocpp.org">std-proposa=
ls+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/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_0_1393696731170--


.