Topic: Require that expressions with commas work in


Author: "'Matt Calabrese' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Tue, 8 Sep 2015 14:00:26 -0700
Raw View
--089e015370f6c5f72d051f42a759
Content-Type: text/plain; charset=UTF-8

On Tue, Sep 8, 2015 at 1:20 PM, Myriachan <myriachan@gmail.com> wrote:

> I think that C++ should require that the standard macros imported from C
> support templated types with commas in them, and similar expressions.  With
> __VA_ARGS__, this is easy to do in all but one case.
>

I agree that this is really hairy right now. My personal thoughts are that,
as you mentioned, making macros directly support commas is not always
possible, and so maybe we should consider alternatives. By that I mean,
even though we might be able to solve this problem for some standard macros
(offsetof is a notable problem, as you stated), but IMO it might be
beneficial to solve a slightly different problem on the caller side by
making it easier to pass a single argument that contains commas. A quick
example of what I mean is, with respect to types, if the syntax
"decltype(type)" worked and was an alias for "type", then people who invoke
a macro with a type name that potentially has commas would be able to just
pass "decltype(type)" instead, without any other tricks and without needing
to make a typedef (which isn't even always possible). This would solve the
(most common?) case where the commas in a single logical macro argument are
a part of a type name. The problem could conceivably be solved for all
cases with a more general identity mechanism that works for things other
than types, though it's not strictly necessary. This also has the benefit
of not changing the declaration or definition of existing macros, so it
would be strictly backwards compatible and not leave us with macros that
are slightly different between C and C++.

--

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

--089e015370f6c5f72d051f42a759
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On T=
ue, Sep 8, 2015 at 1:20 PM, Myriachan <span dir=3D"ltr">&lt;<a href=3D"mail=
to:myriachan@gmail.com" target=3D"_blank">myriachan@gmail.com</a>&gt;</span=
> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I think that C+=
+ should require that the standard macros imported from C support templated=
 types with commas in them, and similar expressions.=C2=A0 With <span style=
=3D"font-family:courier new,monospace">__VA_ARGS__</span>, this is easy to =
do in all but one case<span style=3D"font-family:courier new,monospace"></s=
pan>.</div></blockquote><div><br></div><div>I agree that this is really hai=
ry right now. My personal thoughts are that, as you mentioned, making macro=
s directly support commas is not always possible, and so maybe we should co=
nsider alternatives. By that I mean, even though we might be able to solve =
this problem for some standard macros (offsetof is a notable problem, as yo=
u stated), but IMO it might be beneficial to solve a slightly different pro=
blem on the caller side by making it easier to pass a single argument that =
contains commas. A quick example of what I mean is, with respect to types, =
if the syntax &quot;decltype(type)&quot; worked and was an alias for &quot;=
type&quot;, then people who invoke a macro with a type name that potentiall=
y has commas would be able to just pass &quot;decltype(type)&quot; instead,=
 without any other tricks and without needing to make a typedef (which isn&=
#39;t even always possible). This would solve the (most common?) case where=
 the commas in a single logical macro argument are a part of a type name. T=
he problem could conceivably be solved for all cases with a more general id=
entity mechanism that works for things other than types, though it&#39;s no=
t strictly necessary. This also has the benefit of not changing the declara=
tion or definition of existing macros, so it would be strictly backwards co=
mpatible and not leave us with macros that are slightly different between C=
 and C++.</div></div></div></div>

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

--089e015370f6c5f72d051f42a759--

.


Author: Myriachan <myriachan@gmail.com>
Date: Tue, 8 Sep 2015 14:41:45 -0700 (PDT)
Raw View
------=_Part_2901_1943143727.1441748505298
Content-Type: multipart/alternative;
 boundary="----=_Part_2902_803154505.1441748505299"

------=_Part_2902_803154505.1441748505299
Content-Type: text/plain; charset=UTF-8

On Tuesday, September 8, 2015 at 2:00:29 PM UTC-7, Matt Calabrese wrote:
>
> On Tue, Sep 8, 2015 at 1:20 PM, Myriachan <myri...@gmail.com <javascript:>
> > wrote:
>
>> I think that C++ should require that the standard macros imported from C
>> support templated types with commas in them, and similar expressions.  With
>> __VA_ARGS__, this is easy to do in all but one case.
>>
>
> I agree that this is really hairy right now. My personal thoughts are
> that, as you mentioned, making macros directly support commas is not always
> possible, and so maybe we should consider alternatives. By that I mean,
> even though we might be able to solve this problem for some standard macros
> (offsetof is a notable problem, as you stated), but IMO it might be
> beneficial to solve a slightly different problem on the caller side by
> making it easier to pass a single argument that contains commas. A quick
> example of what I mean is, with respect to types, if the syntax
> "decltype(type)" worked and was an alias for "type", then people who invoke
> a macro with a type name that potentially has commas would be able to just
> pass "decltype(type)" instead, without any other tricks and without needing
> to make a typedef (which isn't even always possible). This would solve the
> (most common?) case where the commas in a single logical macro argument are
> a part of a type name. The problem could conceivably be solved for all
> cases with a more general identity mechanism that works for things other
> than types, though it's not strictly necessary. This also has the benefit
> of not changing the declaration or definition of existing macros, so it
> would be strictly backwards compatible and not leave us with macros that
> are slightly different between C and C++.
>

decltype(type) as an alias for type would be convenient for other reasons,
too.  For example, it would allow implementing a true countof() macro that
worked with both types and expressions:

template <typename T>
struct _countof_helper;

template <typename T, std::size_t S>
struct _countof_helper<T (&)[S]>
{
    static const std::size_t size = S;
};

template <typename T, std::size_t S>
struct _countof_helper<T[S]>
{
    static const std::size_t size = S;
};

#define countof(...) (::_countof_helper<decltype(__VA_ARGS__)>::size)

struct Meow
{
    char meow[4];
};

int main()
{
    int array[2];
    std::printf("%zu\n", countof(int[1]));
    std::printf("%zu\n", countof(array));
    std::printf("%zu\n", countof(Meow::meow));
}

Melissa

--

---
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_2902_803154505.1441748505299
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Tuesday, September 8, 2015 at 2:00:29 PM UTC-7, Matt Calabrese wrote:<bl=
ockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border=
-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><div class=
=3D"gmail_quote">On Tue, Sep 8, 2015 at 1:20 PM, Myriachan <span dir=3D"ltr=
">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"tS=
YtWAXYAQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#3=
9;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;"=
>myri...@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quot=
e" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">=
<div dir=3D"ltr">I think that C++ should require that the standard macros i=
mported from C support templated types with commas in them, and similar exp=
ressions.=C2=A0 With <span style=3D"font-family:courier new,monospace">__VA=
_ARGS__</span>, this is easy to do in all but one case<span style=3D"font-f=
amily:courier new,monospace"></span>.</div></blockquote><div><br></div><div=
>I agree that this is really hairy right now. My personal thoughts are that=
, as you mentioned, making macros directly support commas is not always pos=
sible, and so maybe we should consider alternatives. By that I mean, even t=
hough we might be able to solve this problem for some standard macros (offs=
etof is a notable problem, as you stated), but IMO it might be beneficial t=
o solve a slightly different problem on the caller side by making it easier=
 to pass a single argument that contains commas. A quick example of what I =
mean is, with respect to types, if the syntax &quot;decltype(type)&quot; wo=
rked and was an alias for &quot;type&quot;, then people who invoke a macro =
with a type name that potentially has commas would be able to just pass &qu=
ot;decltype(type)&quot; instead, without any other tricks and without needi=
ng to make a typedef (which isn&#39;t even always possible). This would sol=
ve the (most common?) case where the commas in a single logical macro argum=
ent are a part of a type name. The problem could conceivably be solved for =
all cases with a more general identity mechanism that works for things othe=
r than types, though it&#39;s not strictly necessary. This also has the ben=
efit of not changing the declaration or definition of existing macros, so i=
t would be strictly backwards compatible and not leave us with macros that =
are slightly different between C and C++.</div></div></div></div></blockquo=
te><div><br><span style=3D"font-family: courier new,monospace;">decltype(ty=
pe)</span> as an alias for <span style=3D"font-family: courier new,monospac=
e;">type</span> would be convenient for other reasons, too.=C2=A0 For examp=
le, it would allow implementing a true <span style=3D"font-family: courier =
new,monospace;">countof()</span> macro that worked with both types and expr=
essions:<br><br><div class=3D"prettyprint" style=3D"background-color: rgb(2=
50, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; borde=
r-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div clas=
s=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">template</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> _countof_helper</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">template</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">size_t S</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> _countof_helper</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">T </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(&amp;)[</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">S</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">]&gt;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">static</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">c=
onst</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">size_t size </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> S</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br><br></span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">template</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
typename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">size_t S</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> _countof_helper</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">T</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">[</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">S</span><span style=3D"color: #660;" class=3D"styled-by-prettify">]&g=
t;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">static</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">const</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">size_t size </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> S</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br=
></span><span style=3D"color: #800;" class=3D"styled-by-prettify">#define</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> countof</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">(...)</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(::</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">_countof_helper</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">decltype</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify">__VA_ARGS__</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">)&gt;::</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">size</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
Meow</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">char</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> meow</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"c=
olor: #066;" class=3D"styled-by-prettify">4</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">];</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> main</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> array</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">2</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">];</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">printf</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">(</span><span style=3D"color: #080;" class=3D"styled-by=
-prettify">&quot;%zu\n&quot;</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> countof</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">in=
t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">[</span><=
span style=3D"color: #066;" class=3D"styled-by-prettify">1</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">]));</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 std</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">printf</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #0=
80;" class=3D"styled-by-prettify">&quot;%zu\n&quot;</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> countof</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">array</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">));</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">printf</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&=
quot;%zu\n&quot;</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> co=
untof</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">Meow</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">meow</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">));</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></span></div></code></div><br>Melissa<br></div>

<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_2902_803154505.1441748505299--
------=_Part_2901_1943143727.1441748505298--

.


Author: Vittorio Romeo <vittorio.romeo.vee@gmail.com>
Date: Tue, 8 Sep 2015 14:52:49 -0700 (PDT)
Raw View
------=_Part_967_2120646116.1441749169221
Content-Type: multipart/alternative;
 boundary="----=_Part_968_1739492216.1441749169221"

------=_Part_968_1739492216.1441749169221
Content-Type: text/plain; charset=UTF-8

Backwards-compatible idea - some sort of new #define that allows the user
to choose any delimiter, a-la raw strings.

#define_with_delimiter _, my_sum(a, b) (a + b)
// defines a macro called my_sum with two parameters a and b, delimited by
_,

my_sum(1, 3); // error, only one parameter passed "(1, 3)", macro requires 2
my_sum(1_, 3); // ok, two parameters passed, "(1)" and "(3)"
my_sum(some_number(1, 2, 3)_, 3); // ok, two parameters passed, "some_number(1,
2, 3)" and "(3)"


--

---
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_968_1739492216.1441749169221
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Backwards-compatible idea - some sort of new #define that =
allows the user to choose any delimiter, a-la raw strings.<br><br><div><div=
 class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-=
wrap: break-word; background-color: rgb(250, 250, 250);"><code class=3D"pre=
ttyprint"><div class=3D"subprettyprint"><span style=3D"color: #800;" class=
=3D"styled-by-prettify">#define_with_delimiter _,</span><span style=3D"colo=
r: #800;" class=3D"styled-by-prettify"> my_sum(a, b) (a + b)</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: #800;" class=3D"styled-by-prettify">// defines a macro called my_su=
m with two parameters a and b, delimited by _,</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br><br>my_sum</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #066;=
" class=3D"styled-by-prettify">1</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">3</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #800;" class=3D"styled-by-prettify">// error, only one p=
arameter passed &quot;(1, 3)&quot;, macro requires 2</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>my_sum</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #06=
6;" class=3D"styled-by-prettify">1</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">_</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">3</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">// ok, two parameters passed=
, &quot;(1)&quot; and &quot;(3)&quot;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>my_sum</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">some_number</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">(</span><span style=3D"color: #066;" class=3D"styled-by-=
prettify">1</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #066;" class=3D"styled-by-prettify">2</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;=
" class=3D"styled-by-prettify">3</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">_</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #066;" class=3D"styled-by-prettify">3</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><font color=3D"#0000=
00"></font><span style=3D"color: rgb(136, 0, 0);"><span style=3D"color: #80=
0;" class=3D"styled-by-prettify">// ok, two parameters passed, &quot;</span=
></span><span style=3D"color: #800;" class=3D"styled-by-prettify">some_numb=
er(1, 2, 3)</span><span style=3D"color: rgb(136, 0, 0);"><span style=3D"col=
or: #800;" class=3D"styled-by-prettify">&quot; and &quot;(3)&quot;</span></=
span></div></code></div><br><br></div></div>

<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_968_1739492216.1441749169221--
------=_Part_967_2120646116.1441749169221--

.


Author: David Krauss <potswa@gmail.com>
Date: Wed, 9 Sep 2015 06:41:43 +0800
Raw View
--Apple-Mail=_2380DA93-5D5D-49EC-B7D9-D59E7D566794
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9309=E2=80=9309, at 4:20 AM, Myriachan <myriachan@gmail.com=
> wrote:
>=20
> In some environments, such as GCC and Clang, this is trivial to implement=
, because passing all arguments straight through to __builtin_offsetof()=20

Unfortunately, standard macros are considered untouchable because compiler =
vendors don=E2=80=99t really have freedom to revise their C headers. Althou=
gh your particular platform might map a standard macro to a compiler keywor=
d, it=E2=80=99s not safe to assume that the all de-facto supported platform=
s do the same, or that platform vendors are really interested in supporting=
 ongoing extensions.

I made a similar proposal last year, N4154 Operator assert. It was consider=
ed semantically sound, but unimplementable. If you want to be sure in your =
case, either way, ask a GCC maintainer. Check the changelog of stddef.h or =
assert.h for a recent committer.

--=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=_2380DA93-5D5D-49EC-B7D9-D59E7D566794
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9309=
=E2=80=9309, at 4:20 AM, Myriachan &lt;<a href=3D"mailto:myriachan@gmail.co=
m" class=3D"">myriachan@gmail.com</a>&gt; wrote:</div><br class=3D"Apple-in=
terchange-newline"><div class=3D""><span style=3D"font-family: Helvetica; f=
ont-size: 12px; font-style: normal; font-variant: normal; font-weight: norm=
al; letter-spacing: normal; line-height: normal; orphans: auto; text-align:=
 start; text-indent: 0px; text-transform: none; white-space: normal; widows=
: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; dis=
play: inline !important;" class=3D"">In some environments, such as GCC and =
Clang, this is trivial to implement, because passing all arguments straight=
 through to<span class=3D"Apple-converted-space">&nbsp;</span></span><span =
style=3D"font-size: 12px; font-style: normal; font-variant: normal; font-we=
ight: normal; letter-spacing: normal; line-height: normal; orphans: auto; t=
ext-align: start; text-indent: 0px; text-transform: none; white-space: norm=
al; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-f=
amily: 'courier new', monospace;" class=3D"">__builtin_offsetof()</span><sp=
an style=3D"font-family: Helvetica; font-size: 12px; font-style: normal; fo=
nt-variant: normal; font-weight: normal; letter-spacing: normal; line-heigh=
t: normal; orphans: auto; text-align: start; text-indent: 0px; text-transfo=
rm: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-tex=
t-stroke-width: 0px; float: none; display: inline !important;" class=3D"">&=
nbsp;</span></div></blockquote></div><br class=3D""><div class=3D"">Unfortu=
nately, standard macros are considered untouchable because compiler vendors=
 don=E2=80=99t really have freedom to revise their C headers. Although your=
 particular platform might map a standard macro to a compiler keyword, it=
=E2=80=99s not safe to assume that the all de-facto supported platforms do =
the same, or that platform vendors are really interested in supporting ongo=
ing extensions.</div><div class=3D""><br class=3D""></div><div class=3D"">I=
 made a similar proposal last year, N4154 <i class=3D"">Operator <font face=
=3D"Courier" class=3D"">assert</font></i>. It was considered semantically s=
ound, but unimplementable. If you want to be sure in your case, either way,=
 ask a GCC maintainer. Check the changelog of <font face=3D"Courier" class=
=3D"">stddef.h</font> or <font face=3D"Courier" class=3D"">assert.h</font> =
for a recent committer.</div><div class=3D""><br class=3D""></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=_2380DA93-5D5D-49EC-B7D9-D59E7D566794--

.


Author: Paul Fultz II <pfultz28@gmail.com>
Date: Tue, 8 Sep 2015 15:44:40 -0700 (PDT)
Raw View
------=_Part_2270_773100109.1441752280758
Content-Type: multipart/alternative;
 boundary="----=_Part_2271_767568720.1441752280759"

------=_Part_2271_767568720.1441752280759
Content-Type: text/plain; charset=UTF-8



On Tuesday, September 8, 2015 at 4:52:49 PM UTC-5, Vittorio Romeo wrote:
>
> Backwards-compatible idea - some sort of new #define that allows the user
> to choose any delimiter, a-la raw strings.
>
>

> #define_with_delimiter _, my_sum(a, b) (a + b)
> // defines a macro called my_sum with two parameters a and b, delimited by
> _,
>
> my_sum(1, 3); // error, only one parameter passed "(1, 3)", macro
> requires 2
> my_sum(1_, 3); // ok, two parameters passed, "(1)" and "(3)"
> my_sum(some_number(1, 2, 3)_, 3); // ok, two parameters passed, "some_number(1,
> 2, 3)" and "(3)"
>
>
That is a pretty cool idea, and would open the door to do some amazing pp
metaprogramming. Although, it might be better to limit delimiters to just a
single token(so `_` would be valid but not `_,`). Essentially, we would be
able to write macros in the cmake style, which can be useful for some
applications since C++ still lacks reflection and real concepts.


--

---
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_2271_767568720.1441752280759
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<br><br>On Tuesday, September 8, 2015 at 4:52:49 PM UTC-5, Vittorio Romeo w=
rote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;"><div>Backwards-compatible=
 idea - some sort of new #define that allows the user to choose any delimit=
er, a-la raw strings.<br>=C2=A0</div></blockquote><blockquote class=3D"gmai=
l_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;=
padding-left: 1ex;"><div dir=3D"ltr"><br><div><div style=3D"border:1px soli=
d rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,250)">=
<code><div><span style=3D"color:#800">#define_with_delimiter _,</span><span=
 style=3D"color:#800"> my_sum(a, b) (a + b)</span><span style=3D"color:#000=
"><br></span><span style=3D"color:#800">// defines a macro called my_sum wi=
th two parameters a and b, delimited by _,</span><span style=3D"color:#000"=
><br><br>my_sum</span><span style=3D"color:#660">(</span><span style=3D"col=
or:#066">1</span><span style=3D"color:#660">,</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#066">3</span><span style=3D"color:#660">)=
;</span><span style=3D"color:#000"> </span><span style=3D"color:#800">// er=
ror, only one parameter passed &quot;(1, 3)&quot;, macro requires 2</span><=
span style=3D"color:#000"><br>my_sum</span><span style=3D"color:#660">(</sp=
an><span style=3D"color:#066">1</span><span style=3D"color:#000">_</span><s=
pan style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#066">3</span><span style=3D"color:#660">);</span><span style=
=3D"color:#000"> </span><span style=3D"color:#800">// ok, two parameters pa=
ssed, &quot;(1)&quot; and &quot;(3)&quot;</span><span style=3D"color:#000">=
<br>my_sum</span><span style=3D"color:#660">(</span><span style=3D"color:#0=
00">some_number</span><span style=3D"color:#660">(</span><span style=3D"col=
or:#066">1</span><span style=3D"color:#660">,</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#066">2</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"> </span><span style=3D"color:#066">3</spa=
n><span style=3D"color:#660">)</span><span style=3D"color:#000">_</span><sp=
an style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#066">3</span><span style=3D"color:#660">);</span><span style=
=3D"color:#000"> </span><font color=3D"#000000"></font><span style=3D"color=
:rgb(136,0,0)"><span style=3D"color:#800">// ok, two parameters passed, &qu=
ot;</span></span><span style=3D"color:#800">some_number(1, 2, 3)</span><spa=
n style=3D"color:rgb(136,0,0)"><span style=3D"color:#800">&quot; and &quot;=
(3)&quot;</span></span></div></code></div><br></div></div></blockquote><div=
><br>That is a pretty cool idea, and would open the door to do some amazing=
 pp metaprogramming. Although, it might be better to limit delimiters to ju=
st a single token(so `_` would be valid but not `_,`). Essentially, we woul=
d be able to write macros in the cmake style, which can be useful for some =
applications since C++ still lacks reflection and real concepts.<br>=C2=A0<=
/div>

<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_2271_767568720.1441752280759--
------=_Part_2270_773100109.1441752280758--

.


Author: David Krauss <potswa@gmail.com>
Date: Wed, 9 Sep 2015 07:06:09 +0800
Raw View
--Apple-Mail=_B998A6E8-3210-41ED-A48D-41821F000FD1
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9309=E2=80=9309, at 6:41 AM, David Krauss <potswa@gmail.com=
> wrote:
>=20
> Check the changelog of stddef.h or assert.h for a recent committer.

=E2=80=A6 which is actually glibc, of course. Sorry, I just woke up. Actual=
ly, it might be best to ask first on a mailing list for glibc development.

--=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=_B998A6E8-3210-41ED-A48D-41821F000FD1
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9309=
=E2=80=9309, at 6:41 AM, David Krauss &lt;<a href=3D"mailto:potswa@gmail.co=
m" class=3D"">potswa@gmail.com</a>&gt; wrote:</div><br class=3D"Apple-inter=
change-newline"><div class=3D""><span style=3D"font-family: Helvetica; font=
-size: 12px; font-style: normal; font-variant: normal; font-weight: normal;=
 letter-spacing: normal; line-height: normal; orphans: auto; text-align: st=
art; text-indent: 0px; text-transform: none; white-space: normal; widows: a=
uto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; displa=
y: inline !important;" class=3D"">Check the changelog of<span class=3D"Appl=
e-converted-space">&nbsp;</span></span><font face=3D"Courier" class=3D"" st=
yle=3D"font-size: 12px; font-style: normal; font-variant: normal; font-weig=
ht: normal; letter-spacing: normal; line-height: normal; orphans: auto; tex=
t-align: start; text-indent: 0px; text-transform: none; white-space: normal=
; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">stddef.=
h</font><span style=3D"font-family: Helvetica; font-size: 12px; font-style:=
 normal; font-variant: normal; font-weight: normal; letter-spacing: normal;=
 line-height: normal; orphans: auto; text-align: start; text-indent: 0px; t=
ext-transform: none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; float: none; display: inline !important;" c=
lass=3D""><span class=3D"Apple-converted-space">&nbsp;</span>or<span class=
=3D"Apple-converted-space">&nbsp;</span></span><font face=3D"Courier" class=
=3D"" style=3D"font-size: 12px; font-style: normal; font-variant: normal; f=
ont-weight: normal; letter-spacing: normal; line-height: normal; orphans: a=
uto; text-align: start; text-indent: 0px; text-transform: none; white-space=
: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"=
>assert.h</font><span style=3D"font-family: Helvetica; font-size: 12px; fon=
t-style: normal; font-variant: normal; font-weight: normal; letter-spacing:=
 normal; line-height: normal; orphans: auto; text-align: start; text-indent=
: 0px; text-transform: none; white-space: normal; widows: auto; word-spacin=
g: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !impor=
tant;" class=3D""><span class=3D"Apple-converted-space">&nbsp;</span>for a =
recent committer.</span></div></blockquote></div><br class=3D""><div class=
=3D"">=E2=80=A6 which is actually glibc, of course. Sorry, I just woke up. =
Actually, it might be best to ask first on a mailing list for glibc develop=
ment.</div><div class=3D""><br class=3D""></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=_B998A6E8-3210-41ED-A48D-41821F000FD1--

.


Author: Myriachan <myriachan@gmail.com>
Date: Tue, 8 Sep 2015 19:08:01 -0700 (PDT)
Raw View
------=_Part_96_159867051.1441764481549
Content-Type: multipart/alternative;
 boundary="----=_Part_97_1290134382.1441764481549"

------=_Part_97_1290134382.1441764481549
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Tuesday, September 8, 2015 at 3:41:50 PM UTC-7, David Krauss wrote:
>
>
> On 2015=E2=80=9309=E2=80=9309, at 4:20 AM, Myriachan <myri...@gmail.com <=
javascript:>>=20
> wrote:
>
> In some environments, such as GCC and Clang, this is trivial to implement=
,=20
> because passing all arguments straight through to __builtin_offsetof()=20
>
>
> Unfortunately, standard macros are considered untouchable because compile=
r=20
> vendors don=E2=80=99t really have freedom to revise their C headers. Alth=
ough your=20
> particular platform might map a standard macro to a compiler keyword, it=
=E2=80=99s=20
> not safe to assume that the all de-facto supported platforms do the same,=
=20
> or that platform vendors are really interested in supporting ongoing=20
> extensions.
>
> I made a similar proposal last year, N4154 *Operator assert*. It was=20
> considered semantically sound, but unimplementable. If you want to be sur=
e=20
> in your case, either way, ask a GCC maintainer. Check the changelog of=20
> stddef.h or assert.h for a recent committer.
>
>
Compilers already have to deal with this problem.  One way is to provide a=
=20
separate directory of headers that are searched before the platform's=20
provided headers.  My GCC has=20
/usr/lib/gcc/x86_64-unknown-linux-gnu/[version]/include.

In C++, it's more flexible, because there is <cassert>.  One existing case=
=20
in which the C++ functionality differs from C is with <cstdint>.  <cstdint>=
=20
guarantees the definition of INT_LEAST8_MAX, for example, whereas=20
<stdint.h> does not unless __STDC_LIMIT_MACROS is #defined, a requirement=
=20
that <cstdint> doesn't have.  In order for this to work, <cstdint> in some=
=20
implementations will #undef <stdint.h>'s include guard, #define=20
__STDC_LIMIT_MACROS, then #include <stdint.h> again, in order to cover the=
=20
case in which <cstdint> was #included after a #include <stdint.h> elsewhere=
..

Melissa

--=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_97_1290134382.1441764481549
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Tuesday, September 8, 2015 at 3:41:50 PM UTC-7, David Krauss wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;"><div style=3D"word-wrap:break-word"=
><br><div><blockquote type=3D"cite"><div>On 2015=E2=80=9309=E2=80=9309, at =
4:20 AM, Myriachan &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfusc=
ated-mailto=3D"qspALY3dAQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#=
39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#=
39;;return true;">myri...@gmail.com</a>&gt; wrote:</div><br><div><span styl=
e=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-variant:no=
rmal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align=
:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:=
0px;float:none;display:inline!important">In some environments, such as GCC =
and Clang, this is trivial to implement, because passing all arguments stra=
ight through to<span>=C2=A0</span></span><span style=3D"font-size:12px;font=
-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;=
line-height:normal;text-align:start;text-indent:0px;text-transform:none;whi=
te-space:normal;word-spacing:0px;font-family:&#39;courier new&#39;,monospac=
e">__builtin_offsetof()</span><span style=3D"font-family:Helvetica;font-siz=
e:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spac=
ing:normal;line-height:normal;text-align:start;text-indent:0px;text-transfo=
rm:none;white-space:normal;word-spacing:0px;float:none;display:inline!impor=
tant">=C2=A0</span></div></blockquote></div><br><div>Unfortunately, standar=
d macros are considered untouchable because compiler vendors don=E2=80=99t =
really have freedom to revise their C headers. Although your particular pla=
tform might map a standard macro to a compiler keyword, it=E2=80=99s not sa=
fe to assume that the all de-facto supported platforms do the same, or that=
 platform vendors are really interested in supporting ongoing extensions.</=
div><div><br></div><div>I made a similar proposal last year, N4154 <i>Opera=
tor <font face=3D"Courier">assert</font></i>. It was considered semanticall=
y sound, but unimplementable. If you want to be sure in your case, either w=
ay, ask a GCC maintainer. Check the changelog of <font face=3D"Courier">std=
def.h</font> or <font face=3D"Courier">assert.h</font> for a recent committ=
er.</div><div><br></div></div></blockquote><div><br>Compilers already have =
to deal with this problem.=C2=A0 One way is to provide a separate directory=
 of headers that are searched before the platform&#39;s provided headers.=
=C2=A0 My GCC has /usr/lib/gcc/x86_64-unknown-linux-gnu/[version]/include.<=
br><br>In C++, it&#39;s more flexible, because there is &lt;cassert&gt;.=C2=
=A0 One existing case in which the C++ functionality differs from C is with=
 &lt;cstdint&gt;.=C2=A0 &lt;cstdint&gt; guarantees the definition of INT_LE=
AST8_MAX, for example, whereas &lt;stdint.h&gt; does not unless __STDC_LIMI=
T_MACROS is #defined, a requirement that &lt;cstdint&gt; doesn&#39;t have.=
=C2=A0 In order for this to work, &lt;cstdint&gt; in some implementations w=
ill #undef &lt;stdint.h&gt;&#39;s include guard, #define __STDC_LIMIT_MACRO=
S, then #include &lt;stdint.h&gt; again, in order to cover the case in whic=
h &lt;cstdint&gt; was #included after a #include &lt;stdint.h&gt; elsewhere=
..<br><br>Melissa<br></div>

<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_97_1290134382.1441764481549--
------=_Part_96_159867051.1441764481549--

.


Author: David Krauss <potswa@gmail.com>
Date: Wed, 9 Sep 2015 10:22:42 +0800
Raw View
--Apple-Mail=_BAEB93F6-D2E5-4CB2-B168-DAD46D296881
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9309=E2=80=9309, at 10:08 AM, Myriachan <myriachan@gmail.co=
m> wrote:
>=20
> Compilers already have to deal with this problem.  One way is to provide =
a separate directory of headers that are searched before the platform's pro=
vided headers.  My GCC has /usr/lib/gcc/x86_64-unknown-linux-gnu/[version]/=
include.

That=E2=80=99s a last resort. There are probably committee members who don=
=E2=80=99t want to rely on it. But, what do I know?

> In C++, it's more flexible, because there is <cassert>.=20

I could have defined my proposal to apply to <cassert> and not <assert.h>, =
but that would make #include <assert.h> incur UB. No worse than users doing=
 #define assert by themselves, to be sure, but it would make for an ugly ru=
le. (I admit, I didn=E2=80=99t consider this solution before giving up.)

> One existing case in which the C++ functionality differs from C is with <=
cstdint>.  <cstdint> guarantees the definition of INT_LEAST8_MAX, for examp=
le, whereas <stdint.h> does not unless __STDC_LIMIT_MACROS is #defined, a r=
equirement that <cstdint> doesn't have.  In order for this to work, <cstdin=
t> in some implementations will #undef <stdint.h>'s include guard, #define =
__STDC_LIMIT_MACROS, then #include <stdint.h> again, in order to cover the =
case in which <cstdint> was #included after a #include <stdint.h> elsewhere=
..

It sounds like you have ammunition for this battle. Good luck! Let me know =
if it turns out well; it would be nice to resurrect N4154.

--=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=_BAEB93F6-D2E5-4CB2-B168-DAD46D296881
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9309=
=E2=80=9309, at 10:08 AM, Myriachan &lt;<a href=3D"mailto:myriachan@gmail.c=
om" class=3D"">myriachan@gmail.com</a>&gt; wrote:</div><br class=3D"Apple-i=
nterchange-newline"><div class=3D""><div class=3D"">Compilers already have =
to deal with this problem.&nbsp; One way is to provide a separate directory=
 of headers that are searched before the platform's provided headers.&nbsp;=
 My GCC has /usr/lib/gcc/x86_64-unknown-linux-gnu/[version]/include.<br cla=
ss=3D""></div></div></blockquote><div><br class=3D""></div><div>That=E2=80=
=99s a last resort. There are probably committee members who don=E2=80=99t =
want to rely on it. But, what do I know?</div><br class=3D""><blockquote ty=
pe=3D"cite" class=3D""><div class=3D""><div class=3D"">In C++, it's more fl=
exible, because there is &lt;cassert&gt;.&nbsp; </div></div></blockquote><d=
iv><br class=3D""></div><div>I could have defined my proposal to apply to&n=
bsp;<font face=3D"Courier" class=3D"">&lt;cassert&gt;</font> and not <font =
face=3D"Courier" class=3D"">&lt;assert.h&gt;</font>, but that would make <f=
ont face=3D"Courier" class=3D"">#include &lt;assert.h&gt;</font> incur UB. =
No worse than users doing <font face=3D"Courier" class=3D"">#define assert<=
/font> by themselves, to be sure, but it would make for an ugly rule. (I ad=
mit, I didn=E2=80=99t consider this solution before giving up.)</div><div><=
br class=3D""></div><blockquote type=3D"cite" class=3D""><div class=3D""><d=
iv class=3D"">One existing case in which the C++ functionality differs from=
 C is with &lt;cstdint&gt;.&nbsp; &lt;cstdint&gt; guarantees the definition=
 of INT_LEAST8_MAX, for example, whereas &lt;stdint.h&gt; does not unless _=
_STDC_LIMIT_MACROS is #defined, a requirement that &lt;cstdint&gt; doesn't =
have.&nbsp; In order for this to work, &lt;cstdint&gt; in some implementati=
ons will #undef &lt;stdint.h&gt;'s include guard, #define __STDC_LIMIT_MACR=
OS, then #include &lt;stdint.h&gt; again, in order to cover the case in whi=
ch &lt;cstdint&gt; was #included after a #include &lt;stdint.h&gt; elsewher=
e.<br class=3D""></div></div></blockquote></div><br class=3D""><div class=
=3D"">It sounds like you have ammunition for this battle. Good luck! Let me=
 know if it turns out well; it would be nice to resurrect N4154.</div><div =
class=3D""><br class=3D""></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=_BAEB93F6-D2E5-4CB2-B168-DAD46D296881--

.


Author: Vittorio Romeo <vittorio.romeo.vee@gmail.com>
Date: Wed, 9 Sep 2015 06:05:29 -0700 (PDT)
Raw View
------=_Part_168_876591525.1441803929227
Content-Type: multipart/alternative;
 boundary="----=_Part_169_834073919.1441803929227"

------=_Part_169_834073919.1441803929227
Content-Type: text/plain; charset=UTF-8

Thinking about it again, a better solution would be some kind of new macro
call syntax that would work with existing macros, and make the user choose
the desired delimiter.
Example:

// Regular macro definition
#define add(a, b) (a + b)

// Regular macro call
add(1, 2) /* expands to -> */ (1 + 2)

// User-delimited macro call (delimiter: `,`)
add$[,](1, 2) /* expands to -> */ (1 + 2)

// User-delimited macro call (delimiter: `my_delimiter`)
add$[my_delimiter](1 my_delimiter 2) /* expands to -> */ (1 + 2)

// User-delimited macro call (delimiter: `;;;`)
add$[;;;](add(1, 2) ;;; add(1, 2)) /* expands to -> */ (add(1, 2) + add(1, 2
)) /* expands to -> */ ((1 + 2) + (1 + 2))

What do you think? Is it worth to even consider a possible proposal?

On Wednesday, 9 September 2015 00:44:41 UTC+2, Paul Fultz II wrote:
>
>
>
> On Tuesday, September 8, 2015 at 4:52:49 PM UTC-5, Vittorio Romeo wrote:
>>
>> Backwards-compatible idea - some sort of new #define that allows the user
>> to choose any delimiter, a-la raw strings.
>>
>>
>
>> #define_with_delimiter _, my_sum(a, b) (a + b)
>> // defines a macro called my_sum with two parameters a and b, delimited
>> by _,
>>
>> my_sum(1, 3); // error, only one parameter passed "(1, 3)", macro
>> requires 2
>> my_sum(1_, 3); // ok, two parameters passed, "(1)" and "(3)"
>> my_sum(some_number(1, 2, 3)_, 3); // ok, two parameters passed, "some_number(1,
>> 2, 3)" and "(3)"
>>
>>
> That is a pretty cool idea, and would open the door to do some amazing pp
> metaprogramming. Although, it might be better to limit delimiters to just a
> single token(so `_` would be valid but not `_,`). Essentially, we would be
> able to write macros in the cmake style, which can be useful for some
> applications since C++ still lacks reflection and real concepts.
>
>

--

---
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_169_834073919.1441803929227
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thinking about it again, a better solution would be some k=
ind of new macro call syntax that would work with existing macros, and make=
 the user choose the desired delimiter.<div>Example:</div><div><br></div><d=
iv><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187)=
; word-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><font color=3D"#660066"><spa=
n style=3D"color: #800;" class=3D"styled-by-prettify">// Regular macro defi=
nition</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span><span style=3D"color: #800;" class=3D"styled-by-prettify">#define</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> add</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">a</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> b</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">a </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">+</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> b</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #80=
0;" class=3D"styled-by-prettify">// Regular macro call</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>add</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #066=
;" class=3D"styled-by-prettify">1</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #800;" class=3D"styled-by-prettify">/* expands to -&gt; *=
/</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span styl=
e=3D"color: #066;" class=3D"styled-by-prettify">1</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">+</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-b=
y-prettify">2</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><b=
r></span><span style=3D"color: #800;" class=3D"styled-by-prettify">// User-=
delimited macro call (delimiter: `,`)</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>add$</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">[,](</span><span style=3D"color: #066;" class=3D"s=
tyled-by-prettify">1</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">2</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span></font><span style=
=3D"color: #800;" class=3D"styled-by-prettify">/* expands to -&gt; */</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #066;" class=3D"styled-by-prettify">1</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">+</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></sp=
an><span style=3D"color: #800;" class=3D"styled-by-prettify">// User-delimi=
ted macro call (delimiter: `my_delimiter`)</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br>add$</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">[</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">my_delimiter</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">](</span><span style=3D"color: #066;" class=3D"styl=
ed-by-prettify">1</span><font color=3D"#666600"><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> my_delimiter</span></font><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066=
;" class=3D"styled-by-prettify">2</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pret=
tify">/* expands to -&gt; */</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #066;" class=3D"styled-by-prettify">=
1</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">+</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #066;" class=3D"styled-by-prettify">2</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br><br></span><span style=3D"color: #800;" class=3D"s=
tyled-by-prettify">// User-delimited macro call (delimiter: `;;;`)</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br>add$</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">[;;;](</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">add</span><font color=3D"=
#666600"><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span>=
</font><span style=3D"color: #066;" class=3D"styled-by-prettify">1</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">2</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;;;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> add</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(<=
/span><span style=3D"color: #066;" class=3D"styled-by-prettify">1</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">2</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">))</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-b=
y-prettify">/* expands to -&gt; */</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">add</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
</span><span style=3D"color: #066;" class=3D"styled-by-prettify">1</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">2</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">+</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> add</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #066;" class=3D"styled-by-prettify">1</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
066;" class=3D"styled-by-prettify">2</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">))</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: rgb(136, 0, 0);"><span styl=
e=3D"color: #800;" class=3D"styled-by-prettify">/* expands to -&gt; */</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">((</span><span style=3D"=
color: #066;" class=3D"styled-by-prettify">1</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">+</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pre=
ttify">2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">+</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #066;" =
class=3D"styled-by-prettify">1</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">+</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">2</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">))</span></span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div>=
</code></div><br>What do you think? Is it worth to even consider a possible=
 proposal?<br><br>On Wednesday, 9 September 2015 00:44:41 UTC+2, Paul Fultz=
 II  wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left=
: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><br><br>On Tuesday,=
 September 8, 2015 at 4:52:49 PM UTC-5, Vittorio Romeo wrote:<blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div>Backwards-compatible idea - some sort of new=
 #define that allows the user to choose any delimiter, a-la raw strings.<br=
>=C2=A0</div></blockquote><blockquote class=3D"gmail_quote" style=3D"margin=
:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><br><div><div style=3D"border:1px solid rgb(187,187,187);word-wrap=
:break-word;background-color:rgb(250,250,250)"><code><div><span style=3D"co=
lor:#800">#define_with_delimiter _,</span><span style=3D"color:#800"> my_su=
m(a, b) (a + b)</span><span style=3D"color:#000"><br></span><span style=3D"=
color:#800">// defines a macro called my_sum with two parameters a and b, d=
elimited by _,</span><span style=3D"color:#000"><br><br>my_sum</span><span =
style=3D"color:#660">(</span><span style=3D"color:#066">1</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#066">3</span><span style=3D"color:#660">);</span><span style=3D"color=
:#000"> </span><span style=3D"color:#800">// error, only one parameter pass=
ed &quot;(1, 3)&quot;, macro requires 2</span><span style=3D"color:#000"><b=
r>my_sum</span><span style=3D"color:#660">(</span><span style=3D"color:#066=
">1</span><span style=3D"color:#000">_</span><span style=3D"color:#660">,</=
span><span style=3D"color:#000"> </span><span style=3D"color:#066">3</span>=
<span style=3D"color:#660">);</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#800">// ok, two parameters passed, &quot;(1)&quot; and &q=
uot;(3)&quot;</span><span style=3D"color:#000"><br>my_sum</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">some_number</span><span =
style=3D"color:#660">(</span><span style=3D"color:#066">1</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#066">2</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000"> </span><span style=3D"color:#066">3</span><span style=3D"color:#660"=
>)</span><span style=3D"color:#000">_</span><span style=3D"color:#660">,</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#066">3</span><=
span style=3D"color:#660">);</span><span style=3D"color:#000"> </span><font=
 color=3D"#000000"></font><span style=3D"color:rgb(136,0,0)"><span style=3D=
"color:#800">// ok, two parameters passed, &quot;</span></span><span style=
=3D"color:#800">some_number(1, 2, 3)</span><span style=3D"color:rgb(136,0,0=
)"><span style=3D"color:#800">&quot; and &quot;(3)&quot;</span></span></div=
></code></div><br></div></div></blockquote><div><br>That is a pretty cool i=
dea, and would open the door to do some amazing pp metaprogramming. Althoug=
h, it might be better to limit delimiters to just a single token(so `_` wou=
ld be valid but not `_,`). Essentially, we would be able to write macros in=
 the cmake style, which can be useful for some applications since C++ still=
 lacks reflection and real concepts.<br>=C2=A0</div></blockquote></div></di=
v>

<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_169_834073919.1441803929227--
------=_Part_168_876591525.1441803929227--

.


Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Fri, 11 Sep 2015 00:51:35 -0700 (PDT)
Raw View
------=_Part_711_1503092057.1441957895483
Content-Type: multipart/alternative;
 boundary="----=_Part_712_1035424065.1441957895484"

------=_Part_712_1035424065.1441957895484
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



On Wednesday, September 9, 2015 at 6:05:29 AM UTC-7, Vittorio Romeo wrote:
>
> Thinking about it again, a better solution would be some kind of new macr=
o=20
> call syntax that would work with existing macros, and make the user choos=
e=20
> the desired delimiter.
> Example:
>
> // Regular macro definition
> #define add(a, b) (a + b)
>
> // Regular macro call
> add(1, 2) /* expands to -> */ (1 + 2)
>
> // User-delimited macro call (delimiter: `,`)
> add$[,](1, 2) /* expands to -> */ (1 + 2)
>
> // User-delimited macro call (delimiter: `my_delimiter`)
> add$[my_delimiter](1 my_delimiter 2) /* expands to -> */ (1 + 2)
>
> // User-delimited macro call (delimiter: `;;;`)
> add$[;;;](add(1, 2) ;;; add(1, 2)) /* expands to -> */ (add(1, 2) + add(1=
,=20
> 2)) /* expands to -> */ ((1 + 2) + (1 + 2))
>
> What do you think? Is it worth to even consider a possible proposal?
>


That seems like it would introduce more confusion than it solves. For=20
example, how would __VA_ARGS__ work =E2=80=94 would it separate the args wi=
th=20
commas, or with whatever-custom-delimiters? In situations where foo(...)=20
used to call bar(__VA_ARGS__), now it would have to call=20
bar(__VA_ARGS_separated_with_whatever_delimiter_bar_is_expecting__). It=20
just seems like a couple dozen problems in search of another problem.

What's the original problem anyone's trying to solve here? Is it just that=
=20
you find the double parentheses in

    assert((foo<1,2> =3D=3D 3));

to be ugly? I don't think that's a problem worth breaking C-header=20
compatibility over.

--=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_712_1035424065.1441957895484
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<br><br>On Wednesday, September 9, 2015 at 6:05:29 AM UTC-7, Vittorio Romeo=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.=
8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Thinki=
ng about it again, a better solution would be some kind of new macro call s=
yntax that would work with existing macros, and make the user choose the de=
sired delimiter.<div>Example:</div><div><br></div><div><div style=3D"border=
:1px solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,2=
50,250)"><code><div><font color=3D"#660066"><span style=3D"color:#800">// R=
egular macro definition</span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#800">#define</span><span style=3D"color:#000"> add</span><sp=
an style=3D"color:#660">(</span><span style=3D"color:#000">a</span><span st=
yle=3D"color:#660">,</span><span style=3D"color:#000"> b</span><span style=
=3D"color:#660">)</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#660">(</span><span style=3D"color:#000">a </span><span style=3D"color=
:#660">+</span><span style=3D"color:#000"> b</span><span style=3D"color:#66=
0">)</span><span style=3D"color:#000"><br><br></span><span style=3D"color:#=
800">// Regular macro call</span><span style=3D"color:#000"><br>add</span><=
span style=3D"color:#660">(</span><span style=3D"color:#066">1</span><span =
style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#066">2</span><span style=3D"color:#660">)</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#800">/* expands to -&gt; */</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#660">(</span><span=
 style=3D"color:#066">1</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#660">+</span><span style=3D"color:#000"> </span><span style=3D"=
color:#066">2</span><span style=3D"color:#660">)</span><span style=3D"color=
:#000"><br><br></span><span style=3D"color:#800">// User-delimited macro ca=
ll (delimiter: `,`)</span><span style=3D"color:#000"><br>add$</span><span s=
tyle=3D"color:#660">[,](</span><span style=3D"color:#066">1</span><span sty=
le=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D=
"color:#066">2</span><span style=3D"color:#660">)</span><span style=3D"colo=
r:#000"> </span></font><span style=3D"color:#800">/* expands to -&gt; */</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">(</span><=
span style=3D"color:#066">1</span><span style=3D"color:#000"> </span><span =
style=3D"color:#660">+</span><span style=3D"color:#000"> </span><span style=
=3D"color:#066">2</span><span style=3D"color:#660">)</span><span style=3D"c=
olor:#000"><br><br></span><span style=3D"color:#800">// User-delimited macr=
o call (delimiter: `my_delimiter`)</span><span style=3D"color:#000"><br>add=
$</span><span style=3D"color:#660">[</span><span style=3D"color:#000">my_de=
limiter</span><span style=3D"color:#660">](</span><span style=3D"color:#066=
">1</span><font color=3D"#666600"><span style=3D"color:#000"> my_delimiter<=
/span></font><span style=3D"color:#000"> </span><span style=3D"color:#066">=
2</span><span style=3D"color:#660">)</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#800">/* expands to -&gt; */</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">(</span><span style=3D"color:=
#066">1</span><span style=3D"color:#000"> </span><span style=3D"color:#660"=
>+</span><span style=3D"color:#000"> </span><span style=3D"color:#066">2</s=
pan><span style=3D"color:#660">)</span><span style=3D"color:#000"><br><br><=
/span><span style=3D"color:#800">// User-delimited macro call (delimiter: `=
;;;`)</span><span style=3D"color:#000"><br>add$</span><span style=3D"color:=
#660">[;;;](</span><span style=3D"color:#000">add</span><font color=3D"#666=
600"><span style=3D"color:#660">(</span></font><span style=3D"color:#066">1=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#066">2</span><span style=3D"color:#660">)</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#660">;;;</span><span =
style=3D"color:#000"> add</span><span style=3D"color:#660">(</span><span st=
yle=3D"color:#066">1</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#066">2</span><span style=3D"c=
olor:#660">))</span><span style=3D"color:#000"> </span><span style=3D"color=
:#800">/* expands to -&gt; */</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#660">(</span><span style=3D"color:#000">add</span><span s=
tyle=3D"color:#660">(</span><span style=3D"color:#066">1</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#066">2</span><span style=3D"color:#660">)</span><span style=3D"color:=
#000"> </span><span style=3D"color:#660">+</span><span style=3D"color:#000"=
> add</span><span style=3D"color:#660">(</span><span style=3D"color:#066">1=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#066">2</span><span style=3D"color:#660">))</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:rgb(136,0,0)"><span s=
tyle=3D"color:#800">/* expands to -&gt; */</span><span style=3D"color:#000"=
> </span><span style=3D"color:#660">((</span><span style=3D"color:#066">1</=
span><span style=3D"color:#000"> </span><span style=3D"color:#660">+</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#066">2</span><span=
 style=3D"color:#660">)</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#660">+</span><span style=3D"color:#000"> </span><span style=3D"=
color:#660">(</span><span style=3D"color:#066">1</span><span style=3D"color=
:#000"> </span><span style=3D"color:#660">+</span><span style=3D"color:#000=
"> </span><span style=3D"color:#066">2</span><span style=3D"color:#660">))<=
/span></span><span style=3D"color:#000"><br></span></div></code></div><br>W=
hat do you think? Is it worth to even consider a possible proposal?<br></di=
v></div></blockquote><div><br></div><div><br></div><div>That seems like it =
would introduce more confusion than it solves. For example, how would __VA_=
ARGS__ work =E2=80=94 would it separate the args with commas, or with whate=
ver-custom-delimiters? In situations where foo(...) used to call bar(__VA_A=
RGS__), now it would have to call bar(__VA_ARGS_separated_with_whatever_del=
imiter_bar_is_expecting__). It just seems like a couple dozen problems in s=
earch of another problem.</div><div><br></div><div>What&#39;s the original =
problem anyone&#39;s trying to solve here? Is it just that you find the dou=
ble parentheses in</div><div><br></div><div>=C2=A0 =C2=A0 assert((foo&lt;1,=
2&gt; =3D=3D 3));</div><div><br></div><div>to be ugly? I don&#39;t think th=
at&#39;s a problem worth breaking C-header compatibility over.</div>

<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_712_1035424065.1441957895484--
------=_Part_711_1503092057.1441957895483--

.


Author: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Date: Fri, 11 Sep 2015 21:48:00 -0700 (PDT)
Raw View
------=_Part_1372_2027102715.1442033280693
Content-Type: text/plain; charset=UTF-8

Why not solve the real problem instead by introducong a new template parameter aware macro flavor:

#define<> offsetof(value, member) ...

Mandating that the preprocessor disregards commas between angle brackets in the actuals.

Note: i dont mean that <> above cab be replaced by any old symbol, it must becwritten exactly like that.

--

---
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_1372_2027102715.1442033280693--

.


Author: inkwizytoryankes@gmail.com
Date: Sat, 12 Sep 2015 04:16:20 -0700 (PDT)
Raw View
------=_Part_1746_1268283699.1442056580427
Content-Type: multipart/alternative;
 boundary="----=_Part_1747_896025593.1442056580427"

------=_Part_1747_896025593.1442056580427
Content-Type: text/plain; charset=UTF-8

but this will still require workarounds in opposite case, e.g. you send
less and greater sign in two separate arguments:
somethingWith3args(x < 5, 6 > y, type<int, long>)

I think better is made macro blessed by standard that will escape all
commas:
template<typename T, typename W> class Z { };
#define macro_quote(...)  __VA_ARGS__
#define test(a, b) a b
test(macro_quote(Z<int, long>), t);




On Saturday, September 12, 2015 at 6:48:01 AM UTC+2, Bengt Gustafsson wrote:
>
> Why not solve the real problem instead by introducong a new template
> parameter aware macro flavor:
>
> #define<> offsetof(value, member) ...
>
> Mandating that the preprocessor disregards commas between angle brackets
> in the actuals.
>
> Note: i dont mean that <> above cab be replaced by any old symbol, it must
> becwritten exactly like that.
>
>

--

---
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_1747_896025593.1442056580427
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">but this will still require workarounds in opposite case, =
e.g. you send less and greater sign in two separate arguments:<br><div clas=
s=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-col=
or: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: =
break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">somethingWith3args</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">x </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066=
;" class=3D"styled-by-prettify">5</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">6</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> y</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> type</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">int</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">long</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&gt;)</span></div></code></div><br>I think better is made macro blessed by =
standard that will escape all commas:<br><div class=3D"prettyprint" style=
=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187);=
 border-style: solid; border-width: 1px; word-wrap: break-word;"><code clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;=
" class=3D"styled-by-prettify">template</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">ty=
pename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> W</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> Z </span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br></span><span style=3D"color: #800;" class=3D"styled-by-pretti=
fy">#define</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> macro_quote</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(...)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
=C2=A0__VA_ARGS__<br></span><span style=3D"color: #800;" class=3D"styled-by=
-prettify">#define</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> test</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">a</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> b</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> a b<br>test</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">macro_quote</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">Z</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">long</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">&gt;),</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> t</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">);</span></div></code></div><br><br><br=
><br>On Saturday, September 12, 2015 at 6:48:01 AM UTC+2, Bengt Gustafsson =
wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;">Why not solve the real p=
roblem instead by introducong a new template parameter aware macro flavor:<=
p>#define&lt;&gt; offsetof(value, member) ...</p><p>Mandating that the prep=
rocessor disregards commas between angle brackets in the actuals.</p><p>Not=
e: i dont mean that &lt;&gt; above cab be replaced by any old symbol, it mu=
st becwritten exactly like that.</p><p></p><p></p></blockquote></div>

<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_1747_896025593.1442056580427--
------=_Part_1746_1268283699.1442056580427--

.


Author: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Date: Mon, 14 Sep 2015 01:34:32 -0700 (PDT)
Raw View
------=_Part_153_2083748875.1442219672312
Content-Type: multipart/alternative;
 boundary="----=_Part_154_234540711.1442219672313"

------=_Part_154_234540711.1442219672313
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Well, firsty, sending parts of expressions to macros probably sees much=20
less usage than sending names of types. Secondly, mixing types and partial=
=20
expressions
to the same macro must be even more uncommon. This said, as you showed, it=
=20
is possible to construct a corner case where neither the current or my=20
modified parsing of macro parameters performs as expected. Requiring=20
special syntax at the call site is what we have to do today, so I can't see=
=20
this as a solution.

Instead, if we want to cover your corner case we would have to annotate=20
each formal macro parameter separately as how commas enclosed in <> should=
=20
be treated. This complicates both the standards text and the=20
implementatoin, but I think it is quite doable. For instance:

#define somethingWith3args(expr1, expr2, type<>)

or even:

#define somethingWith3args(expr1, expr2, typename type)


Here the preprocessor would have to start treating <> as matched=20
parentheses once the two first parameters have been seen, which should not=
=20
be too onerous.

I assume this still leaves with the famous:

template<typename T, bool X> class C;

C<int, a>b> myC;

But as I recall even the C++ compiler can't parse this without a=20
parenthesis around a>b so it would be too much to ask from the=20
preprocessor...

Going back to your initial problem a simpler solution would be to require=
=20
special treatment of expression parts with > or < in them when used in a=20
#define<> macro, this is also consistent with when you have to "fix" your=
=20
bool expression int the template case.

 somethingWith3args((x < 5), (6 > y), type<int, long>)

But then again of course there could be this macro that only takes an=20
operator as a parameter, pasting it into some expression it generates. Then=
=20
writing (<) won't work.

I definitely think that this should be solved on the macro definition side,=
=20
not at the macro call site. Requiring annotation at the call site is not=20
much of an improvement of what we already do.


Den l=C3=B6rdag 12 september 2015 kl. 13:16:20 UTC+2 skrev inkwizyt...@gmai=
l.com:
>
> but this will still require workarounds in opposite case, e.g. you send=
=20
> less and greater sign in two separate arguments:
> somethingWith3args(x < 5, 6 > y, type<int, long>)
>
> I think better is made macro blessed by standard that will escape all=20
> commas:
> template<typename T, typename W> class Z { };
> #define macro_quote(...)  __VA_ARGS__
> #define test(a, b) a b
> test(macro_quote(Z<int, long>), t);
>
>
>
>
> On Saturday, September 12, 2015 at 6:48:01 AM UTC+2, Bengt Gustafsson=20
> wrote:
>>
>> Why not solve the real problem instead by introducong a new template=20
>> parameter aware macro flavor:
>>
>> #define<> offsetof(value, member) ...
>>
>> Mandating that the preprocessor disregards commas between angle brackets=
=20
>> in the actuals.
>>
>> Note: i dont mean that <> above cab be replaced by any old symbol, it=20
>> must becwritten exactly like that.
>>
>>

--=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_154_234540711.1442219672313
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Well, firsty, sending parts of expressions to macros proba=
bly sees much less usage than sending names of types. Secondly, mixing type=
s and partial expressions<div>to the same macro must be even more uncommon.=
 This said, as you showed, it is possible to construct a corner case where =
neither the current or my modified parsing of macro parameters performs as =
expected. Requiring special syntax at the call site is what we have to do t=
oday, so I can&#39;t see this as a solution.</div><div><br></div><div>Inste=
ad, if we want to cover your corner case we would have to annotate each for=
mal macro parameter separately as how commas enclosed in &lt;&gt; should be=
 treated. This complicates both the standards text and the implementatoin, =
but I think it is quite doable. For instance:</div><div><br></div><div><div=
 class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-=
wrap: break-word; background-color: rgb(250, 250, 250);"><code class=3D"pre=
ttyprint"><div class=3D"subprettyprint"><span style=3D"color: #800;" class=
=3D"styled-by-prettify">#define</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> somethingWith3args</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">expr1</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> expr2</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> type<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&gt;)</=
span></div></code></div><span style=3D"color: rgb(0, 0, 0); font-family: mo=
nospace; background-color: rgb(250, 250, 250);"><br></span></div><div><font=
 color=3D"#000000" face=3D"arial, sans-serif">or even:</font></div><div><fo=
nt color=3D"#000000" face=3D"monospace"><br></font></div><div><div class=3D=
"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: bre=
ak-word; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"=
><div class=3D"subprettyprint"><span style=3D"color: #800;" class=3D"styled=
-by-prettify">#define</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> somethingWith3args</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">expr1</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ex=
pr2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> type</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">)</span></div><div><span class=
=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);"><br></span></div=
></code></div><span style=3D"color: rgb(0, 0, 0); font-family: monospace; b=
ackground-color: rgb(250, 250, 250);"></span></div><div><font color=3D"#000=
000" face=3D"monospace"><br></font></div><div><font color=3D"#000000"><font=
 face=3D"arial, sans-serif">Here the preprocessor would have to start treat=
ing &lt;&gt; as matched parentheses once the two first parameters have been=
 seen, which should not be too onerous.</font></font></div><div><font color=
=3D"#000000"><font face=3D"arial, sans-serif"><br></font></font></div><div>=
<font color=3D"#000000"><font face=3D"arial, sans-serif">I assume this stil=
l leaves with the famous:</font></font></div><div><font color=3D"#000000"><=
font face=3D"arial, sans-serif"><br></font></font></div><div><font color=3D=
"#000000"><font face=3D"arial, sans-serif">template&lt;typename T, bool X&g=
t; class C;</font></font></div><div><font color=3D"#000000"><font face=3D"a=
rial, sans-serif"><br></font></font></div><div><font color=3D"#000000"><fon=
t face=3D"arial, sans-serif">C&lt;int, a&gt;b&gt; myC;</font></font></div><=
div><span style=3D"color: rgb(0, 0, 0); font-family: arial, sans-serif;"><b=
r></span></div><div><span style=3D"color: rgb(0, 0, 0); font-family: arial,=
 sans-serif;">But as I recall even the C++ compiler can&#39;t parse this wi=
thout a parenthesis around a&gt;b so it would be too much to ask from the p=
reprocessor...</span></div><div><span style=3D"color: rgb(0, 0, 0); font-fa=
mily: arial, sans-serif;"><br></span></div><div><span style=3D"color: rgb(0=
, 0, 0); font-family: arial, sans-serif;">Going back to your initial proble=
m a simpler solution would be to require special treatment of expression pa=
rts with &gt; or &lt; in them when used in a #define&lt;&gt; macro, this is=
 also consistent with when you have to &quot;fix&quot; your bool expression=
 int the template case.</span></div><div><span style=3D"color: rgb(0, 0, 0)=
; font-family: arial, sans-serif;"><br></span></div><div><span style=3D"col=
or: rgb(0, 0, 0); font-family: arial, sans-serif;">=C2=A0</span><span style=
=3D"font-family: monospace; color: rgb(0, 0, 0); background-color: rgb(250,=
 250, 250);">somethingWith3args</span><span style=3D"font-family: monospace=
; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">((</span>=
<span style=3D"font-family: monospace; color: rgb(0, 0, 0); background-colo=
r: rgb(250, 250, 250);">x=C2=A0</span><span style=3D"font-family: monospace=
; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">&lt;</spa=
n><span style=3D"font-family: monospace; color: rgb(0, 0, 0); background-co=
lor: rgb(250, 250, 250);">=C2=A0</span><span style=3D"font-family: monospac=
e; color: rgb(0, 102, 102); background-color: rgb(250, 250, 250);">5)</span=
><span style=3D"font-family: monospace; color: rgb(102, 102, 0); background=
-color: rgb(250, 250, 250);">,</span><span style=3D"font-family: monospace;=
 color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">=C2=A0(</span>=
<span style=3D"font-family: monospace; color: rgb(0, 102, 102); background-=
color: rgb(250, 250, 250);">6</span><span style=3D"font-family: monospace; =
color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">=C2=A0</span><s=
pan style=3D"font-family: monospace; color: rgb(102, 102, 0); background-co=
lor: rgb(250, 250, 250);">&gt;</span><span style=3D"font-family: monospace;=
 color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">=C2=A0y)</span=
><span style=3D"font-family: monospace; color: rgb(102, 102, 0); background=
-color: rgb(250, 250, 250);">,</span><span style=3D"font-family: monospace;=
 color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">=C2=A0type</sp=
an><span style=3D"font-family: monospace; color: rgb(102, 102, 0); backgrou=
nd-color: rgb(250, 250, 250);">&lt;</span><span style=3D"font-family: monos=
pace; color: rgb(0, 0, 136); background-color: rgb(250, 250, 250);">int</sp=
an><span style=3D"font-family: monospace; color: rgb(102, 102, 0); backgrou=
nd-color: rgb(250, 250, 250);">,</span><span style=3D"font-family: monospac=
e; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">=C2=A0</span=
><span style=3D"font-family: monospace; color: rgb(0, 0, 136); background-c=
olor: rgb(250, 250, 250);">long</span><span style=3D"font-family: monospace=
; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">&gt;)</sp=
an></div><div><span style=3D"font-family: monospace; color: rgb(102, 102, 0=
); background-color: rgb(250, 250, 250);"><br></span></div>But then again o=
f course there could be this macro that only takes an operator as a paramet=
er, pasting it into some expression it generates. Then writing (&lt;) won&#=
39;t work.<div><br></div><div>I definitely think that this should be solved=
 on the macro definition side, not at the macro call site. Requiring annota=
tion at the call site is not much of an improvement of what we already do.<=
br><div><font color=3D"#666600" face=3D"arial, sans-serif"><span style=3D"b=
ackground-color: rgb(250, 250, 250);"><br></span></font></div><div><br>Den =
l=C3=B6rdag 12 september 2015 kl. 13:16:20 UTC+2 skrev inkwizyt...@gmail.co=
m:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;b=
order-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">but this wi=
ll still require workarounds in opposite case, e.g. you send less and great=
er sign in two separate arguments:<br><div style=3D"background-color:rgb(25=
0,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1p=
x;word-wrap:break-word"><code><div><span style=3D"color:#000">somethingWith=
3args</span><span style=3D"color:#660">(</span><span style=3D"color:#000">x=
 </span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#066">5</span><span style=3D"color:#660">,</span=
><span style=3D"color:#000"> </span><span style=3D"color:#066">6</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#660">&gt;</span><span =
style=3D"color:#000"> y</span><span style=3D"color:#660">,</span><span styl=
e=3D"color:#000"> type</span><span style=3D"color:#660">&lt;</span><span st=
yle=3D"color:#008">int</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">long</span><span style=
=3D"color:#660">&gt;)</span></div></code></div><br>I think better is made m=
acro blessed by standard that will escape all commas:<br><div style=3D"back=
ground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:so=
lid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:=
#008">template</span><span style=3D"color:#660">&lt;</span><span style=3D"c=
olor:#008">typename</span><span style=3D"color:#000"> T</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#008">typename</span><span style=3D"color:#000"> W</span><span style=
=3D"color:#660">&gt;</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">class</span><span style=3D"color:#000"> Z </span><span styl=
e=3D"color:#660">{</span><span style=3D"color:#000"> </span><span style=3D"=
color:#660">};</span><span style=3D"color:#000"><br></span><span style=3D"c=
olor:#800">#define</span><span style=3D"color:#000"> macro_quote</span><spa=
n style=3D"color:#660">(...)</span><span style=3D"color:#000"> =C2=A0__VA_A=
RGS__<br></span><span style=3D"color:#800">#define</span><span style=3D"col=
or:#000"> test</span><span style=3D"color:#660">(</span><span style=3D"colo=
r:#000">a</span><span style=3D"color:#660">,</span><span style=3D"color:#00=
0"> b</span><span style=3D"color:#660">)</span><span style=3D"color:#000"> =
a b<br>test</span><span style=3D"color:#660">(</span><span style=3D"color:#=
000">macro_quote</span><span style=3D"color:#660">(</span><span style=3D"co=
lor:#000">Z</span><span style=3D"color:#660">&lt;</span><span style=3D"colo=
r:#008">int</span><span style=3D"color:#660">,</span><span style=3D"color:#=
000"> </span><span style=3D"color:#008">long</span><span style=3D"color:#66=
0">&gt;),</span><span style=3D"color:#000"> t</span><span style=3D"color:#6=
60">);</span></div></code></div><br><br><br><br>On Saturday, September 12, =
2015 at 6:48:01 AM UTC+2, Bengt Gustafsson wrote:<blockquote class=3D"gmail=
_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">Why not solve the real problem instead by introducong a new t=
emplate parameter aware macro flavor:<p>#define&lt;&gt; offsetof(value, mem=
ber) ...</p><p>Mandating that the preprocessor disregards commas between an=
gle brackets in the actuals.</p><p>Note: i dont mean that &lt;&gt; above ca=
b be replaced by any old symbol, it must becwritten exactly like that.</p><=
p></p><p></p></blockquote></div></blockquote></div></div></div>

<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_154_234540711.1442219672313--
------=_Part_153_2083748875.1442219672312--

.