Topic: C11 Anonymous structs
Author: Matthew Fioravante <fmatthew5876@gmail.com>
Date: Sun, 30 Sep 2018 14:34:55 -0700 (PDT)
Raw View
------=_Part_943_348348317.1538343295426
Content-Type: multipart/alternative;
boundary="----=_Part_944_984232894.1538343295427"
------=_Part_944_984232894.1538343295427
Content-Type: text/plain; charset="UTF-8"
Is there any good reason why the standard technically doesn't support
anonymous structs like:
struct vec {
union {
struct {
double x, y, z;
};
double v[3];
};
};
Compiling this with gcc -pedantic results in a warning:
warning: ISO C++ prohibits anonymous structs
When I google about this, people complain about maybe it invokes UB. But
just giving the anonymous struct a name is equivalent and allowed:
struct vec {
union {
struct {
double x, y, z;
} s;
double v[3];
};
};
Also it's a C11 feature so we should be compatible.
I'm guess it's just another one nobody took time to write a proposal for?
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/8dadb4a9-7487-4328-a79d-3e289e9ec613%40isocpp.org.
------=_Part_944_984232894.1538343295427
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Is there any good reason why the standard technically=
doesn't support anonymous structs like:</div><div><br></div><div style=
=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187);=
border-style: solid; border-width: 1px; overflow-wrap: break-word;" class=
=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subprettyprint">=
<span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> vec </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">union</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">struct</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"> =C2=A0 </span><a href=3D"/"></a><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">double</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> x</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> y</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">,</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;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">double=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> v</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">[</span><span styl=
e=3D"color: #066;" class=3D"styled-by-prettify">3</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">];</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>=C2=A0 </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"st=
yled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br></span></div></code></div><div><br></div><div>Compiling this =
with gcc -pedantic results in a warning:</div><div><br></div><div><code>war=
ning: ISO C++ prohibits anonymous structs</code></div><div><br>When I googl=
e about this, people complain about maybe it invokes UB. But just giving th=
e anonymous struct a name is equivalent and allowed:</div><div><br></div><d=
iv><div><br></div><div style=3D"background-color: rgb(250, 250, 250); borde=
r-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overfl=
ow-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettyprint"><di=
v class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-=
prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> vec </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 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">union<=
/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"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> =C2=A0 <br>=C2=A0 =C2=A0 =C2=A0 </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">double</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> x</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> y</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> z</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 </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
s</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=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">double</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> v</span><spa=
n style=3D"color: #660;" 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"styled-by-prettify"><br>=C2=A0 </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"st=
yled-by-prettify">};</span></div></code></div><br>Also it's a C11 featu=
re so we should be compatible.</div><div><br></div><div>I'm guess it=
9;s just another one nobody took time to write a proposal for?<br></div></d=
iv>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8dadb4a9-7487-4328-a79d-3e289e9ec613%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8dadb4a9-7487-4328-a79d-3e289e9ec613=
%40isocpp.org</a>.<br />
------=_Part_944_984232894.1538343295427--
------=_Part_943_348348317.1538343295426--
.
Author: Jens Maurer <Jens.Maurer@gmx.net>
Date: Mon, 01 Oct 2018 07:47:53 +0200
Raw View
On 09/30/2018 11:34 PM, Matthew Fioravante wrote:
> Is there any good reason why the standard technically doesn't support anonymous structs like:
>
> ||
> structvec {
> union{
> struct{ </>
> doublex,y,z;
> };
> doublev[3];
> };
> };
>
> Compiling this with gcc -pedantic results in a warning:
>
> |warning: ISO C++ prohibits anonymous structs|
>
> When I google about this, people complain about maybe it invokes UB. But just giving the anonymous struct a name is equivalent and allowed:
>
>
> ||
> structvec {
> union{
> struct{
> doublex,y,z;
> }s;
> doublev[3];
> };
> };
>
> Also it's a C11 feature so we should be compatible.
>
> I'm guess it's just another one nobody took time to write a proposal for?
My initial guess is, yes.
Note, however, that the core language wording for anonymous unions has been
the source of some headaches over the past decades; it would be good not to
repeat that experience with anonymous non-union classes.
Jesn
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5BB1B509.6030109%40gmx.net.
.
Author: Peter Sommerlad <peter.sommerlad@hsr.ch>
Date: Mon, 1 Oct 2018 09:13:56 +0200
Raw View
--Apple-Mail-69CB46AF-30BD-401B-A67F-E3FF9091E2A3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
The first version of your code declares an unnamed type only and no member.=
Since there is no valid way to use that type in C++ it is IMHO correct to =
not allow that. Even in the second version please note that the type punnin=
g that those unions are often used for in C is not valid in the C++ type sy=
stem, except for very specific cases.=20
Regards
Peter
sent from a mobile device.
Prof. Peter Sommerlad
peter.Sommerlad@hsr.ch
+41-79-432 23 32
> On 30 Sep 2018, at 23:35, Matthew Fioravante <fmatthew5876@gmail.com> wro=
te:
>=20
> Is there any good reason why the standard technically doesn't support ano=
nymous structs like:
>=20
> struct vec {
> union {
> struct { =20
> double x, y, z;
> };
> double v[3];
> };
> };
>=20
> Compiling this with gcc -pedantic results in a warning:
>=20
> warning: ISO C++ prohibits anonymous structs
>=20
> When I google about this, people complain about maybe it invokes UB. But =
just giving the anonymous struct a name is equivalent and allowed:
>=20
>=20
> struct vec {
> union {
> struct { =20
> double x, y, z;
> } s;
> double v[3];
> };
> };
>=20
> Also it's a C11 feature so we should be compatible.
>=20
> I'm guess it's just another one nobody took time to write a proposal for?
> --=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=
email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit https://groups.google.com/a/isoc=
pp.org/d/msgid/std-proposals/8dadb4a9-7487-4328-a79d-3e289e9ec613%40isocpp.=
org.
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/F2ED69A4-7545-40CA-93C5-90784DAA9B5E%40hsr.ch.
--Apple-Mail-69CB46AF-30BD-401B-A67F-E3FF9091E2A3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto">The first version of your code declares=
an unnamed type only and no member. Since there is no valid way to use tha=
t type in C++ it is IMHO correct to not allow that. Even in the second vers=
ion please note that the type punning that those unions are often used for =
in C is not valid in the C++ type system, except for very specific cases.&n=
bsp;<div><br></div><div>Regards</div><div>Peter<br><br><div id=3D"AppleMail=
Signature"><div>sent from a mobile device.</div>Prof. Peter Sommerlad<div><=
a href=3D"mailto:peter.Sommerlad@hsr.ch">peter.Sommerlad@hsr.ch</a></div><d=
iv>+41-79-432 23 32</div></div><div><br>On 30 Sep 2018, at 23:35, Matthew F=
ioravante <<a href=3D"mailto:fmatthew5876@gmail.com">fmatthew5876@gmail.=
com</a>> wrote:<br><br></div><blockquote type=3D"cite"><div><meta http-e=
quiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8"><div dir=3D"lt=
r"><div>Is there any good reason why the standard technically doesn't suppo=
rt anonymous structs like:</div><div><br></div><div style=3D"background-col=
or: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: sol=
id; border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><c=
ode class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> vec </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: #008;" class=
=3D"styled-by-prettify">union</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </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: #008;" class=3D"styled-by-p=
rettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><a href=3D"/"></a><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">double</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> x</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> y<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an 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;" class=3D"styled-by-prettify"><br> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">double</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> v</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">[</span><span style=3D"color: #066;" cla=
ss=3D"styled-by-prettify">3</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">];</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br> </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 style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><=
/div></code></div><div><br></div><div>Compiling this with gcc -pedantic res=
ults in a warning:</div><div><br></div><div><code>warning: ISO C++ prohibit=
s anonymous structs</code></div><div><br>When I google about this, people c=
omplain about maybe it invokes UB. But just giving the anonymous struct a n=
ame is equivalent and allowed:</div><div><br></div><div><div><br></div><div=
style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187,=
187); border-style: solid; border-width: 1px; overflow-wrap: break-word;" =
class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subprettypr=
int"><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> vec </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br> </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">union</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">struct</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"> <br> </span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">double</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> x</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> y</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> z=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br> <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> s</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: #008;" class=3D"styled-by-prettify">double</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> v</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">[</span><span style=3D"color: #066;" cla=
ss=3D"styled-by-prettify">3</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">];</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br> </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></div></code></div><br>Also it's a C11 feature so we should be compati=
ble.</div><div><br></div><div>I'm guess it's just another one nobody took t=
ime to write a proposal for?<br></div></div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" 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>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8dadb4a9-7487-4328-a79d-3e289e9ec613%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.goo=
gle.com/a/isocpp.org/d/msgid/std-proposals/8dadb4a9-7487-4328-a79d-3e289e9e=
c613%40isocpp.org</a>.<br>
</div></blockquote></div></body></html>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/F2ED69A4-7545-40CA-93C5-90784DAA9B5E%=
40hsr.ch?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/F2ED69A4-7545-40CA-93C5-90784DAA9B5E%40h=
sr.ch</a>.<br />
--Apple-Mail-69CB46AF-30BD-401B-A67F-E3FF9091E2A3--
.
Author: Ray Hamel <rayghamel@gmail.com>
Date: Mon, 1 Oct 2018 17:16:13 -0700 (PDT)
Raw View
------=_Part_1603_1840881887.1538439373378
Content-Type: multipart/alternative;
boundary="----=_Part_1604_853253422.1538439373378"
------=_Part_1604_853253422.1538439373378
Content-Type: text/plain; charset="UTF-8"
Peter,
the type punning that those unions are often used for in C is not valid in
> the C++ type system, except for very specific cases.
>
I believe it is now well-defined (for standard-layout types) as of C++17.
- Ray
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/077885f0-cf82-468d-addd-28be9b99a95e%40isocpp.org.
------=_Part_1604_853253422.1538439373378
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Peter,<br></div><div><br></div><blockquote class=3D"g=
mail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(=
204, 204, 204); padding-left: 1ex;"><div>the type punning that those unions=
are often used for=20
in C is not valid in the C++ type system, except for very specific=20
cases. <br></div></blockquote><div><br></div><div>I believe it is now well-=
defined (for standard-layout types) as of C++17.</div><div><br></div><div>-=
Ray</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/077885f0-cf82-468d-addd-28be9b99a95e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/077885f0-cf82-468d-addd-28be9b99a95e=
%40isocpp.org</a>.<br />
------=_Part_1604_853253422.1538439373378--
------=_Part_1603_1840881887.1538439373378--
.
Author: Matthew Fioravante <fmatthew5876@gmail.com>
Date: Tue, 2 Oct 2018 07:06:59 -0700 (PDT)
Raw View
------=_Part_1064_1721548513.1538489219301
Content-Type: multipart/alternative;
boundary="----=_Part_1065_1129942946.1538489219302"
------=_Part_1065_1129942946.1538489219302
Content-Type: text/plain; charset="UTF-8"
Standardeze technicalities aside, there is no reason my example shouldn't
work, especially since compilers already need to support it for C11.
Maybe this one can be added as a defect report? How does one report a
defect?
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/fbddb859-f325-4789-ab2c-0b78a1af2837%40isocpp.org.
------=_Part_1065_1129942946.1538489219302
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Standardeze technicalities aside, there is no reason =
my example shouldn't work, especially since compilers already need to s=
upport it for C11.</div><div><br></div><div>Maybe this one can be added as =
a defect report? How does one report a defect?<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/fbddb859-f325-4789-ab2c-0b78a1af2837%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fbddb859-f325-4789-ab2c-0b78a1af2837=
%40isocpp.org</a>.<br />
------=_Part_1065_1129942946.1538489219302--
------=_Part_1064_1721548513.1538489219301--
.
Author: Nicolas Lesser <blitzrakete@gmail.com>
Date: Tue, 2 Oct 2018 19:22:32 +0200
Raw View
--0000000000008d32270577422b1e
Content-Type: text/plain; charset="UTF-8"
On Tue, Oct 2, 2018 at 4:07 PM Matthew Fioravante <fmatthew5876@gmail.com>
wrote:
> Standardeze technicalities aside, there is no reason my example shouldn't
> work, especially since compilers already need to support it for C11.
>
"why not?" is not a good motivation to add something to the standard. You
need to provide actual motivation why this feature is useful and why we
can't achieve this today already.
> Maybe this one can be added as a defect report? How does one report a
> defect?
>
You email Mike Miller, but this isn't a defect, it's a new feature. Defect
reports are for things like (unintentional) oversights, unclear wording,
wording holes, ...
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/fbddb859-f325-4789-ab2c-0b78a1af2837%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/fbddb859-f325-4789-ab2c-0b78a1af2837%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmDwq0LU0jq180OEVWBn1esJxZGU%3DQDEnVptdCh7yHgsjYcLg%40mail.gmail.com.
--0000000000008d32270577422b1e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue, Oct 2,=
2018 at 4:07 PM Matthew Fioravante <<a href=3D"mailto:fmatthew5876@gmai=
l.com">fmatthew5876@gmail.com</a>> wrote:<br></div><blockquote class=3D"=
gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-=
left:1ex"><div dir=3D"ltr"><div>Standardeze technicalities aside, there is =
no reason my example shouldn't work, especially since compilers already=
need to support it for C11.</div></div></blockquote><div>=C2=A0</div><div>=
"why not?" is not a good motivation to add something to the stand=
ard. You need to provide actual motivation why this feature is useful and w=
hy we can't achieve this today already.</div><div><br></div><blockquote=
class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc soli=
d;padding-left:1ex"><div dir=3D"ltr"><div><br></div><div>Maybe this one can=
be added as a defect report? How does one report a defect?<br></div></div>=
</blockquote><div><br></div><div>You email Mike Miller, but this isn't =
a defect, it's a new feature. Defect reports are for things like (unint=
entional) oversights, unclear wording, wording holes, ...=C2=A0</div><block=
quote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc=
solid;padding-left:1ex"><div dir=3D"ltr"><div></div></div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/fbddb859-f325-4789-ab2c-0b78a1af2837%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/fbddb859-f325-=
4789-ab2c-0b78a1af2837%40isocpp.org</a>.<br>
</blockquote></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CALmDwq0LU0jq180OEVWBn1esJxZGU%3DQDEn=
VptdCh7yHgsjYcLg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmDwq0LU0jq18=
0OEVWBn1esJxZGU%3DQDEnVptdCh7yHgsjYcLg%40mail.gmail.com</a>.<br />
--0000000000008d32270577422b1e--
.
Author: Andrew Giese <gieseanw@gmail.com>
Date: Wed, 3 Oct 2018 08:12:16 -0700 (PDT)
Raw View
------=_Part_2411_564214363.1538579536835
Content-Type: multipart/alternative;
boundary="----=_Part_2412_831602841.1538579536835"
------=_Part_2412_831602841.1538579536835
Content-Type: text/plain; charset="UTF-8"
Like Ray Hamel mentioned, C++11 and C++14 officially support C99, not C11.
Refer to [intro.scope]
C++ is a general purpose programming language based on the C programming
> language as described in
> ISO/IEC 9899:1999
C++17 changed this wording to support C11 (also [intro.scope])
C++ is a general purpose programming language based on the C programming
> language as described in
> ISO/IEC 9899:2011
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/8f2ecd53-e0c8-4441-8cc6-c3e3e188ed10%40isocpp.org.
------=_Part_2412_831602841.1538579536835
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Like Ray Hamel mentioned, C++11 and C++14 officially suppo=
rt C99, not C11.<div>Refer to=C2=A0[intro.scope]</div><div><br></div><div><=
blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border=
-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">C++ is a general p=
urpose programming language based on the C programming language as describe=
d in<br>ISO/IEC 9899:1999</blockquote><div><br></div><div><br></div><div>C+=
+17 changed this wording to support C11 (also=C2=A0[intro.scope])</div><div=
><br></div><div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px =
0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">C=
++ is a general purpose programming language based on the C programming lan=
guage as described in<br>ISO/IEC 9899:2011</blockquote></div><div><br></div=
><div>=C2=A0</div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8f2ecd53-e0c8-4441-8cc6-c3e3e188ed10%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8f2ecd53-e0c8-4441-8cc6-c3e3e188ed10=
%40isocpp.org</a>.<br />
------=_Part_2412_831602841.1538579536835--
------=_Part_2411_564214363.1538579536835--
.
Author: florian.csdt@gmail.com
Date: Thu, 4 Oct 2018 04:52:47 -0700 (PDT)
Raw View
------=_Part_182_463576314.1538653967371
Content-Type: multipart/alternative;
boundary="----=_Part_183_214847021.1538653967371"
------=_Part_183_214847021.1538653967371
Content-Type: text/plain; charset="UTF-8"
C and C++ are two different and now diverging languages.
C has no notion of nested structs so when you write this:
struct Foo {
struct Bar {
int i;
};
};
You are defining an empty struct Foo and the definition of Bar is just
discarded.
While in C++, you also define Foo::Bar.
What I want to highlight: the behavior of the two languages is already
different without considering anonymous structs. So just because C does it
is not a valid reason to put it in C++.
That being said, I think it is still a valuable feature for C++ on its own.
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/33180627-ede8-4e04-b7c5-3b9c67a146a0%40isocpp.org.
------=_Part_183_214847021.1538653967371
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>C and C++ are two different and now diverging languag=
es.</div><div><br></div><div>C has no notion of nested structs so when you =
write this:</div><div><div style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; ov=
erflow-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettyprint"=
><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled=
-by-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>Foo</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">Bar</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"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> i</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></co=
de></div>You are defining an empty struct Foo and the definition of Bar is =
just discarded.</div><div>While in C++, you also define Foo::Bar.</div><div=
><br></div><div>What I want to highlight: the behavior of the two languages=
is already different without considering anonymous structs. So just becaus=
e C does it is not a valid reason to put it in C++.</div><div><br></div><di=
v>That being said, I think it is still a valuable feature for C++ on its ow=
n.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/33180627-ede8-4e04-b7c5-3b9c67a146a0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/33180627-ede8-4e04-b7c5-3b9c67a146a0=
%40isocpp.org</a>.<br />
------=_Part_183_214847021.1538653967371--
------=_Part_182_463576314.1538653967371--
.
Author: Tom Honermann <tom@honermann.net>
Date: Thu, 4 Oct 2018 09:33:42 -0400
Raw View
This is a multi-part message in MIME format.
--------------37880F7E3611A893BB161A8D
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable
On 10/04/2018 07:52 AM, florian.csdt@gmail.com wrote:
> C and C++ are two different and now diverging languages.
>
> C has no notion of nested structs so when you write this:
> |
> structFoo{
> structBar{
> inti;
> };
> };
> |
> You are defining an empty struct Foo and the definition of Bar is just=20
> discarded.
Bar isn't actually discarded; it is still a defined class at file scope=20
in C:
struct Foo {
=C2=A0 struct Bar {
=C2=A0=C2=A0=C2=A0 int i;
=C2=A0 };
};
struct Bar b =3D { 1 }; // Ok in C, ill-formed in C++ (Bar is an=20
incomplete type)
Tom.
> While in C++, you also define Foo::Bar.
>
> What I want to highlight: the behavior of the two languages is already=20
> different without considering anonymous structs. So just because C=20
> does it is not a valid reason to put it in C++.
>
> That being said, I think it is still a valuable feature for C++ on its=20
> own.
> --=20
> You received this message because you are subscribed to the Google=20
> Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send=20
> an email to std-proposals+unsubscribe@isocpp.org=20
> <mailto:std-proposals+unsubscribe@isocpp.org>.
> To post to this group, send email to std-proposals@isocpp.org=20
> <mailto:std-proposals@isocpp.org>.
> To view this discussion on the web visit=20
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/33180627-ede=
8-4e04-b7c5-3b9c67a146a0%40isocpp.org=20
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/33180627-ed=
e8-4e04-b7c5-3b9c67a146a0%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>.
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/fce8bdbd-e1bd-d2fd-dae5-44936d7635a8%40honermann=
..net.
--------------37880F7E3611A893BB161A8D
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8=
">
</head>
<body text=3D"#000000" bgcolor=3D"#FFFFFF">
<div class=3D"moz-cite-prefix">On 10/04/2018 07:52 AM,
<a class=3D"moz-txt-link-abbreviated" href=3D"mailto:florian.csdt@gma=
il.com">florian.csdt@gmail.com</a> wrote:<br>
</div>
<blockquote type=3D"cite"
cite=3D"mid:33180627-ede8-4e04-b7c5-3b9c67a146a0@isocpp.org">
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf=
-8">
<div dir=3D"ltr">
<div>C and C++ are two different and now diverging languages.</div>
<div><br>
</div>
<div>C has no notion of nested structs so when you write this:</div=
>
<div>
<div style=3D"background-color: rgb(250, 250, 250);
border-color: rgb(187, 187, 187); border-style: solid;
border-width: 1px; overflow-wrap: break-word;"
class=3D"prettyprint"><code class=3D"prettyprint">
<div class=3D"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">struct</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
style=3D"color: #606;" class=3D"styled-by-prettify">Foo</=
span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">{</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
=C2=A0 </span><span style=3D"color: #008;"
class=3D"styled-by-prettify">struct</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
style=3D"color: #606;" class=3D"styled-by-prettify">Bar</=
span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">{</sp=
an><span
style=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
style=3D"color: #000;" class=3D"styled-by-prettify"> i</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
=C2=A0 </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
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span></div>
</code></div>
You are defining an empty struct Foo and the definition of Bar
is just discarded.</div>
</div>
</blockquote>
<br>
Bar isn't actually discarded; it is still a defined class at file
scope in C:<br>
<br>
<tt>struct Foo {</tt><tt><br>
</tt><tt>=C2=A0 struct Bar {</tt><tt><br>
</tt><tt>=C2=A0=C2=A0=C2=A0 int i;</tt><tt><br>
</tt><tt>=C2=A0 };</tt><tt><br>
</tt><tt>};</tt><tt><br>
</tt><tt>struct Bar b =3D { 1 }; // Ok in C, ill-formed in C++ (Bar is
an incomplete type)</tt><br>
<br>
Tom.<br>
<br>
<blockquote type=3D"cite"
cite=3D"mid:33180627-ede8-4e04-b7c5-3b9c67a146a0@isocpp.org">
<div dir=3D"ltr">
<div>While in C++, you also define Foo::Bar.</div>
<div><br>
</div>
<div>What I want to highlight: the behavior of the two languages
is already different without considering anonymous structs. So
just because C does it is not a valid reason to put it in C++.</d=
iv>
<div><br>
</div>
<div>That being said, I think it is still a valuable feature for
C++ on its own.<br>
</div>
</div>
-- <br>
You received this message because you are subscribed to the Google
Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it,
send an email to <a
href=3D"mailto:std-proposals+unsubscribe@isocpp.org"
moz-do-not-send=3D"true">std-proposals+unsubscribe@isocpp.org</a>.<=
br>
To post to this group, send email to <a
href=3D"mailto:std-proposals@isocpp.org" moz-do-not-send=3D"true">s=
td-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a
href=3D"https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/331806=
27-ede8-4e04-b7c5-3b9c67a146a0%40isocpp.org?utm_medium=3Demail&utm_sour=
ce=3Dfooter"
moz-do-not-send=3D"true">https://groups.google.com/a/isocpp.org/d/m=
sgid/std-proposals/33180627-ede8-4e04-b7c5-3b9c67a146a0%40isocpp.org</a>.<b=
r>
</blockquote>
<p><br>
</p>
</body>
</html>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/fce8bdbd-e1bd-d2fd-dae5-44936d7635a8%=
40honermann.net?utm_medium=3Demail&utm_source=3Dfooter">https://groups.goog=
le.com/a/isocpp.org/d/msgid/std-proposals/fce8bdbd-e1bd-d2fd-dae5-44936d763=
5a8%40honermann.net</a>.<br />
--------------37880F7E3611A893BB161A8D--
.
Author: florian.csdt@gmail.com
Date: Thu, 4 Oct 2018 06:40:08 -0700 (PDT)
Raw View
------=_Part_284_1852579167.1538660408477
Content-Type: multipart/alternative;
boundary="----=_Part_285_136676014.1538660408478"
------=_Part_285_136676014.1538660408478
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Le jeudi 4 octobre 2018 15:33:45 UTC+2, Tom Honermann a =C3=A9crit :
>
> On 10/04/2018 07:52 AM, floria...@gmail.com <javascript:> wrote:
>
> C and C++ are two different and now diverging languages.
>
> C has no notion of nested structs so when you write this:
> struct Foo {
> struct Bar {
> int i;
> };
> };
> You are defining an empty struct Foo and the definition of Bar is just=20
> discarded.
>
>
> Bar isn't actually discarded; it is still a defined class at file scope i=
n=20
> C:
>
> struct Foo {
> struct Bar {
> int i;
> };
> };
> struct Bar b =3D { 1 }; // Ok in C, ill-formed in C++ (Bar is an incomple=
te=20
> type)
>
>
I was mislead by GCC: warning: declaration does not declare anything
But that means the difference is even bigger than what I expected, and that=
=20
makes the argument "it's already in C11" even less relevant.
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/d3ce17d9-5d91-4de5-b7de-faa18b7c3b7e%40isocpp.or=
g.
------=_Part_285_136676014.1538660408478
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>Le jeudi 4 octobre 2018 15:33:45 UTC+2, Tom Honerm=
ann a =C3=A9crit=C2=A0:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
=20
=20
=20
<div text=3D"#000000" bgcolor=3D"#FFFFFF">
<div>On 10/04/2018 07:52 AM,
<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"xd=
8mjJvWAgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:=
9;;return true;" onclick=3D"this.href=3D'javascript:';return true;"=
>floria...@gmail.com</a> wrote:<br>
</div>
<blockquote type=3D"cite">
=20
<div dir=3D"ltr">
<div>C and C++ are two different and now diverging languages.</div>
<div><br>
</div>
<div>C has no notion of nested structs so when you write this:</div=
>
<div>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(=
187,187,187);border-style:solid;border-width:1px"><code>
<div><span style=3D"color:#008">struct</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#606">Foo</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#660">{</span><span style=3D"color:#00=
0"><br>
=C2=A0 </span><span style=3D"color:#008">struct</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#606">Bar</span><span =
style=3D"color:#000"> </span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"><br>
=C2=A0 =C2=A0 </span><span style=3D"color:#008">int</span=
><span style=3D"color:#000"> i</span><span style=3D"color:#660">;</span><sp=
an style=3D"color:#000"><br>
=C2=A0 </span><span style=3D"color:#660">};</span><span s=
tyle=3D"color:#000"><br>
</span><span style=3D"color:#660">};</span><span style=3D"c=
olor:#000"><br>
</span></div>
</code></div>
You are defining an empty struct Foo and the definition of Bar
is just discarded.</div>
</div>
</blockquote>
<br>
Bar isn't actually discarded; it is still a defined class at file
scope in C:<br>
<br>
<tt>struct Foo {</tt><tt><br>
</tt><tt>=C2=A0 struct Bar {</tt><tt><br>
</tt><tt>=C2=A0=C2=A0=C2=A0 int i;</tt><tt><br>
</tt><tt>=C2=A0 };</tt><tt><br>
</tt><tt>};</tt><tt><br>
</tt><tt>struct Bar b =3D { 1 }; // Ok in C, ill-formed in C++ (Bar is
an incomplete type)</tt><br>
<br></div></blockquote><div><br></div><div>I was mislead by GCC: <span =
style=3D"font-family: courier new, monospace;">warning: declaration does no=
t declare anything</span><br></div><div><br></div><div>But that means the d=
ifference is even bigger than what I expected, and that makes the argument =
"it's already in C11" even less relevant.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d3ce17d9-5d91-4de5-b7de-faa18b7c3b7e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d3ce17d9-5d91-4de5-b7de-faa18b7c3b7e=
%40isocpp.org</a>.<br />
------=_Part_285_136676014.1538660408478--
------=_Part_284_1852579167.1538660408477--
.
Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Thu, 4 Oct 2018 23:11:10 -0700 (PDT)
Raw View
------=_Part_630_1329036158.1538719870196
Content-Type: multipart/alternative;
boundary="----=_Part_631_1123300781.1538719870196"
------=_Part_631_1123300781.1538719870196
Content-Type: text/plain; charset="UTF-8"
On Thursday, October 4, 2018 at 4:40:08 PM UTC+3, floria...@gmail.com wrote:
>
>
> But that means the difference is even bigger than what I expected, and
> that makes the argument "it's already in C11" even less relevant.
>
I dislike this approach. For each incompatibility between C and C++ we
should have an explanation "why can't we afford this feature in C++". We
have such explanations for implicit pointers conversion, nested structs,
sizeof('a'), complex types, VLAs, restrict, etc. If we don't have such
clear explanation, we should just eliminate the incompatibility.
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/b874b2ee-4480-43c6-a0b2-7b0c8ccf48ad%40isocpp.org.
------=_Part_631_1123300781.1538719870196
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, October 4, 2018 at 4:40:08 PM UTC+3, floria..=
..@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr"><br><div>But that means the difference is even bigger than what I expe=
cted, and that makes the argument "it's already in C11" even =
less relevant.<br></div></div></blockquote><div><br></div><div>I dislike th=
is approach. For each incompatibility between C and C++ we should have an e=
xplanation "why can't we afford this feature in C++". We have=
such explanations for implicit pointers conversion, nested structs, sizeof=
('a'), complex types, VLAs, restrict, etc. If we don't have suc=
h clear explanation, we should just eliminate the incompatibility.<br></div=
><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/b874b2ee-4480-43c6-a0b2-7b0c8ccf48ad%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b874b2ee-4480-43c6-a0b2-7b0c8ccf48ad=
%40isocpp.org</a>.<br />
------=_Part_631_1123300781.1538719870196--
------=_Part_630_1329036158.1538719870196--
.
Author: florian.csdt@gmail.com
Date: Fri, 5 Oct 2018 01:57:53 -0700 (PDT)
Raw View
------=_Part_644_845217919.1538729873109
Content-Type: multipart/alternative;
boundary="----=_Part_645_1894914638.1538729873110"
------=_Part_645_1894914638.1538729873110
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Le vendredi 5 octobre 2018 08:11:10 UTC+2, Victor Dyachenko a =C3=A9crit :
>
> On Thursday, October 4, 2018 at 4:40:08 PM UTC+3, floria...@gmail.com=20
> wrote:
>>
>>
>> But that means the difference is even bigger than what I expected, and=
=20
>> that makes the argument "it's already in C11" even less relevant.
>>
>
> I dislike this approach. For each incompatibility between C and C++ we=20
> should have an explanation "why can't we afford this feature in C++". We=
=20
> have such explanations for implicit pointers conversion, nested structs,=
=20
> sizeof('a'), complex types, VLAs, restrict, etc. If we don't have such=20
> clear explanation, we should just eliminate the incompatibility.
>
>
I have the impression you misunderstood my point, so let me rephrase.
Anonymous structs is based on "nested" structs (at least syntax-wise). But=
=20
nested structs is supported (somehow) by the 2 languages with 2 different=
=20
meaning:
in C, the nested definition just defines the struct in the global=20
namespace, whereas in C++, it is in the outer class namespace.
Those are incompatible and never will be (because C has only the global=20
namespace).
The anonymous struct is a "variant" of this syntax.
All that to say: what applies to C doesn't apply to C++ because of this=20
incompatibility that can never be lifted.
Don't get me wrong: I never said we shouldn't have anonymous struct in C++.=
=20
I'm just saying: because it is close to a "feature" that is essentially=20
incompatible between the 2 languages, "it is in C, so we need it C++" is=20
not a valid argument on its own.
It can only be a small plus in the end once we have real arguments for=20
anonymous structs in C++.
My whole point is: we need to have real reasons to put it in C++, and just=
=20
say "it's already in C" is not enough.
I'm all in favor to have anonymous structs in C++, but I haven't thought=20
long enough yet to raise a real argument for it.
And please remember the question of the OP: Is there any good reason why=20
the standard technically doesn't support anonymous structs?
The answer is yes: nobody has expressed enough interest to make it part of=
=20
C++, and just "because it's in C" is far from enough.
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/1198efb9-2cf1-4ab4-bfb5-970cb2f73ccd%40isocpp.or=
g.
------=_Part_645_1894914638.1538729873110
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br>Le vendredi 5 octobre 2018 08:11:10 UTC+2, Victor Dyac=
henko a =C3=A9crit=C2=A0:<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">On Thursday, October 4, 2018 at 4:40:08 PM UTC+3, <a>floria...@=
gmail.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;mar=
gin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr=
"><br><div>But that means the difference is even bigger than what I expecte=
d, and that makes the argument "it's already in C11" even les=
s relevant.<br></div></div></blockquote><div><br></div><div>I dislike this =
approach. For each incompatibility between C and C++ we should have an expl=
anation "why can't we afford this feature in C++". We have su=
ch explanations for implicit pointers conversion, nested structs, sizeof(&#=
39;a'), complex types, VLAs, restrict, etc. If we don't have such c=
lear explanation, we should just eliminate the incompatibility.<br></div><b=
r></div></blockquote><div><br></div><div>I have the impression you misunder=
stood my point, so let me rephrase.</div><div><br></div><div>Anonymous stru=
cts is based on "nested" structs (at least syntax-wise). But nest=
ed structs is supported (somehow) by the 2 languages with 2 different meani=
ng:</div><div>in C, the nested definition just defines the struct in the gl=
obal namespace, whereas in C++, it is in the outer class namespace.</div><d=
iv>Those are incompatible and never will be (because C has only the global =
namespace).</div><div>The anonymous struct is a "variant" of this=
syntax.</div><div>All that to say: what applies to C doesn't apply to =
C++ because of this incompatibility that can never be lifted.</div><div><br=
></div><div>Don't get me wrong: I never said we shouldn't have anon=
ymous struct in C++. I'm just saying: because it is close to a "fe=
ature" that is essentially incompatible between the 2 languages, "=
;it is in C, so we need it C++" is not a valid argument on its own.</d=
iv><div>It can only be a small plus in the end once we have real arguments =
for anonymous structs in C++.</div><br><div>My whole point is: we need to h=
ave real reasons to put it in C++, and just say "it's already in C=
" is not enough.<br><div>I'm all in favor to have anonymous struct=
s in C++, but I haven't thought long enough yet to raise a real argumen=
t for it.</div><div><br></div><div>And please remember the question of the =
OP: Is there any good reason why the standard technically doesn't suppo=
rt anonymous structs?</div><div>The answer is yes: nobody has expressed eno=
ugh interest to make it part of C++, and just "because it's in C&q=
uot; is far from enough.<br></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/1198efb9-2cf1-4ab4-bfb5-970cb2f73ccd%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/1198efb9-2cf1-4ab4-bfb5-970cb2f73ccd=
%40isocpp.org</a>.<br />
------=_Part_645_1894914638.1538729873110--
------=_Part_644_845217919.1538729873109--
.