Topic: template patameter issue?!


Author: theabcofthings@gmail.com
Date: Sat, 3 Jun 2017 23:39:28 -0700 (PDT)
Raw View
------=_Part_1650_1593748406.1496558368616
Content-Type: multipart/alternative;
 boundary="----=_Part_1651_532926742.1496558368616"

------=_Part_1651_532926742.1496558368616
Content-Type: text/plain; charset="UTF-8"

GCC 7.1.0, c++1z

template<typename T = float, T d = 0.0f>
class A
{
    T temp = d;
};

"error: 'float' is not a valid type for a template non-type parameter"

May be... just may be.. in 2017 year we should have it already working?
Thank you.

--
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/e819da1d-f77d-4280-8172-2e4868c7240c%40isocpp.org.

------=_Part_1651_532926742.1496558368616
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">GCC 7.1.0, c++1z<br><br>template&lt;typename T =3D float, =
T d =3D 0.0f&gt;<br>class A<br>{<br>=C2=A0=C2=A0=C2=A0 T temp =3D d;<br>};<=
br><br>&quot;error: &#39;float&#39; is not a valid type for a template non-=
type parameter&quot;<br><br>May be... just may be.. in 2017 year we should =
have it already working?<br>Thank you.<br><br></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e819da1d-f77d-4280-8172-2e4868c7240c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e819da1d-f77d-4280-8172-2e4868c7240c=
%40isocpp.org</a>.<br />

------=_Part_1651_532926742.1496558368616--

------=_Part_1650_1593748406.1496558368616--

.


Author: Todd Fleming <tbfleming@gmail.com>
Date: Sun, 4 Jun 2017 11:55:08 -0700 (PDT)
Raw View
------=_Part_1904_971920584.1496602508390
Content-Type: multipart/alternative;
 boundary="----=_Part_1905_603218549.1496602508390"

------=_Part_1905_603218549.1496602508390
Content-Type: text/plain; charset="UTF-8"

How do you propose handling numeric stability issues?

On Sunday, June 4, 2017 at 2:39:28 AM UTC-4, theabco...@gmail.com wrote:
>
> GCC 7.1.0, c++1z
>
> template<typename T = float, T d = 0.0f>
> class A
> {
>     T temp = d;
> };
>
> "error: 'float' is not a valid type for a template non-type parameter"
>
> May be... just may be.. in 2017 year we should have it already working?
> Thank you.
>
>

--
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/13b637f9-986f-483f-a05c-8344d4f12bf2%40isocpp.org.

------=_Part_1905_603218549.1496602508390
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">How do you propose handling numeric stability issues?<br><=
br>On Sunday, June 4, 2017 at 2:39:28 AM UTC-4, theabco...@gmail.com wrote:=
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bor=
der-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">GCC 7.1.0, c+=
+1z<br><br>template&lt;typename T =3D float, T d =3D 0.0f&gt;<br>class A<br=
>{<br>=C2=A0=C2=A0=C2=A0 T temp =3D d;<br>};<br><br>&quot;error: &#39;float=
&#39; is not a valid type for a template non-type parameter&quot;<br><br>Ma=
y be... just may be.. in 2017 year we should have it already working?<br>Th=
ank you.<br><br></div></blockquote></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/13b637f9-986f-483f-a05c-8344d4f12bf2%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/13b637f9-986f-483f-a05c-8344d4f12bf2=
%40isocpp.org</a>.<br />

------=_Part_1905_603218549.1496602508390--

------=_Part_1904_971920584.1496602508390--

.


Author: "'Johannes Schaub' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Mon, 5 Jun 2017 11:53:19 +0200
Raw View
2017-06-04 8:39 GMT+02:00  <theabcofthings@gmail.com>:
> GCC 7.1.0, c++1z
>
> template<typename T = float, T d = 0.0f>
> class A
> {
>     T temp = d;
> };
>
> "error: 'float' is not a valid type for a template non-type parameter"
>
> May be... just may be.. in 2017 year we should have it already working?
> Thank you.
>

What happened in 2017 to warrant this change? Why would we not also
allow using doubles as array indices, then?

--
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/CANu6V4VQUNmFBJLTuM%3Dv9tN3jLE9HD70R8jS%3DOsaSfB4L1_UhA%40mail.gmail.com.

.


Author: the.ultimate.koala@gmail.com
Date: Fri, 25 Aug 2017 07:46:35 -0700 (PDT)
Raw View
------=_Part_2678_1465030079.1503672395065
Content-Type: multipart/alternative;
 boundary="----=_Part_2679_1346119669.1503672395065"

------=_Part_2679_1346119669.1503672395065
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



Le dimanche 4 juin 2017 20:55:08 UTC+2, Todd Fleming a =C3=A9crit :
>
> How do you propose handling numeric stability issues?
>

Could you elaborate on that ? I myself wonder why one cannot use at least a=
=20
floating point literal as a template parameter argument. A floating point=
=20
literal denotes (I believe) a single binary representation, and these=20
binary representations can be compared for identity. I believe=20
(uncheckedly) that one can use long long template parameters, so it is not=
=20
a problem of compiler capacity.

--=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/66f4fd46-935c-431a-93f0-0244cc230df3%40isocpp.or=
g.

------=_Part_2679_1346119669.1503672395065
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>Le dimanche 4 juin 2017 20:55:08 UTC+2, Todd Flemi=
ng 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">How do you propose handling numeric stability issues?</div></block=
quote><div><br>Could you elaborate on that ? I myself wonder why one cannot=
 use at least a floating point literal as a template parameter argument. A =
floating point literal denotes (I believe) a single binary representation, =
and these binary representations can be compared for identity. I believe (u=
ncheckedly) that one can use long long template parameters, so it is not a =
problem of compiler capacity.<br></div></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/66f4fd46-935c-431a-93f0-0244cc230df3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/66f4fd46-935c-431a-93f0-0244cc230df3=
%40isocpp.org</a>.<br />

------=_Part_2679_1346119669.1503672395065--

------=_Part_2678_1465030079.1503672395065--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 25 Aug 2017 07:58:41 -0700 (PDT)
Raw View
------=_Part_2543_1789349291.1503673121585
Content-Type: multipart/alternative;
 boundary="----=_Part_2544_1154701234.1503673121585"

------=_Part_2544_1154701234.1503673121585
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Friday, August 25, 2017 at 10:46:35 AM UTC-4, the.ultim...@gmail.com=20
wrote:
>
>
>
> Le dimanche 4 juin 2017 20:55:08 UTC+2, Todd Fleming a =C3=A9crit :
>>
>> How do you propose handling numeric stability issues?
>>
>
> Could you elaborate on that ? I myself wonder why one cannot use at least=
=20
> a floating point literal as a template parameter argument.
>

Because that now makes a significant distinction that the standard has=20
never made before. Even in C++98/03, non-type template parameters could be=
=20
any constant expression. `1 + 2` is as good as `3` for a non-type template=
=20
parameter, and compilers had to deal with that.

To limit the use of floating-point non-type template parameters to just=20
literals wouldn't even allow you to pass a float template parameter to a=20
different template:

template<float f> void foo();

template<float f> void bar() {foo<f>();}

You could try to restrict it to "literal or template parameter". But=20
ultimately, what good is all of that? If you can't do expression=20
calculations on these values, if you're stuck with literals as the ultimate=
=20
source of the value, what's the point of the feature?

And even that still isn't enough to fix the problem:

A floating point literal denotes (I believe) a single binary=20
> representation, and these binary representations can be compared for=20
> identity.
>

If I instantiate a template `foo<5>` and then with `foo<6>`, the standard=
=20
guarantees these are going to be two *different* templates. By contrast,=20
there is no guarantee that two floating point literals which use different=
=20
numbers will have different binary representations. Will `foo<5.2>` be a=20
different type from `foo<5.19999999>`? How many `9`s does it take for them=
=20
to not be different?
=20

> I believe (uncheckedly) that one can use long long template parameters, s=
o=20
> it is not a problem of compiler capacity.
>

--=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/ab5c4a7d-710c-4a63-9d51-20c699627226%40isocpp.or=
g.

------=_Part_2544_1154701234.1503673121585
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, August 25, 2017 at 10:46:35 AM UTC-4, the.ultim=
....@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><br><br>Le dimanche 4 juin 2017 20:55:08 UTC+2, Todd Fleming a =C3=
=A9crit=C2=A0:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-le=
ft:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">How =
do you propose handling numeric stability issues?</div></blockquote><div><b=
r>Could you elaborate on that ? I myself wonder why one cannot use at least=
 a floating point literal as a template parameter argument.</div></div></bl=
ockquote><div><br>Because that now makes a significant distinction that the=
 standard has never made before. Even in C++98/03, non-type template parame=
ters could be any constant expression. `1 + 2` is as good as `3` for a non-=
type template parameter, and compilers had to deal with that.<br><br>To lim=
it the use of floating-point non-type template parameters to just literals =
wouldn&#39;t even allow you to pass a float template parameter to a differe=
nt template:<br><br><div style=3D"background-color: rgb(250, 250, 250); bor=
der-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; over=
flow-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettyprint"><=
div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">template</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">float</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
f</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> foo</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><br></span><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">float</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> f</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">void=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> bar</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">()</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">foo</span><span style=3D"color: #080;" cla=
ss=3D"styled-by-prettify">&lt;f&gt;</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">();}</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></span></div></code></div><br>You could try to restr=
ict it to &quot;literal or template parameter&quot;. But ultimately, what g=
ood is all of that? If you can&#39;t do expression calculations on these va=
lues, if you&#39;re stuck with literals as the ultimate source of the value=
, what&#39;s the point of the feature?<br><br>And even that still isn&#39;t=
 enough to fix the problem:<br><br></div><blockquote class=3D"gmail_quote" =
style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-l=
eft: 1ex;"><div dir=3D"ltr"><div>A floating point literal denotes (I believ=
e) a single binary representation, and these binary representations can be =
compared for identity.</div></div></blockquote><div><br>If I instantiate a =
template `foo&lt;5&gt;` and then with `foo&lt;6&gt;`, the standard guarante=
es these are going to be two <i>different</i> templates. By contrast, there=
 is no guarantee that two floating point literals which use different numbe=
rs will have different binary representations. Will `foo&lt;5.2&gt;` be a d=
ifferent type from `foo&lt;5.19999999&gt;`? How many `9`s does it take for =
them to not be different?<br>=C2=A0</div><blockquote class=3D"gmail_quote" =
style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-l=
eft: 1ex;"><div dir=3D"ltr"><div>I believe (uncheckedly) that one can use l=
ong long template parameters, so it is not a problem of compiler capacity.<=
br></div></div></blockquote></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ab5c4a7d-710c-4a63-9d51-20c699627226%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ab5c4a7d-710c-4a63-9d51-20c699627226=
%40isocpp.org</a>.<br />

------=_Part_2544_1154701234.1503673121585--

------=_Part_2543_1789349291.1503673121585--

.


Author: Todd Fleming <tbfleming@gmail.com>
Date: Fri, 25 Aug 2017 07:59:40 -0700 (PDT)
Raw View
------=_Part_2734_674156597.1503673180165
Content-Type: multipart/alternative;
 boundary="----=_Part_2735_403820303.1503673180166"

------=_Part_2735_403820303.1503673180166
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

constexpr float a =3D 1.0f / 3.0f;
Foo<a * 3.0f> obj1;
Foo<1.0f> obj2 =3D obj1;

Should the standard require:
1. obj1 and obj2 have the same type?
2. obj1 and obj2 have different types?

On Friday, August 25, 2017 at 10:46:35 AM UTC-4, the.ultim...@gmail.com=20
wrote:
>
>
>
> Le dimanche 4 juin 2017 20:55:08 UTC+2, Todd Fleming a =C3=A9crit :
>>
>> How do you propose handling numeric stability issues?
>>
>
> Could you elaborate on that ? I myself wonder why one cannot use at least=
=20
> a floating point literal as a template parameter argument. A floating poi=
nt=20
> literal denotes (I believe) a single binary representation, and these=20
> binary representations can be compared for identity. I believe=20
> (uncheckedly) that one can use long long template parameters, so it is no=
t=20
> a problem of compiler capacity.
>

--=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/cd56a1aa-464c-498a-8675-06880f74879c%40isocpp.or=
g.

------=_Part_2735_403820303.1503673180166
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">constexpr float a =3D 1.0f / 3.0f;<div>Foo&lt;a * 3.0f&gt;=
 obj1;</div><div>Foo&lt;1.0f&gt; obj2 =3D obj1;</div><div><br></div><div>Sh=
ould the standard require:</div><div>1. obj1 and obj2 have the same type?</=
div><div>2. obj1 and obj2 have different types?</div><div><br></div>On Frid=
ay, August 25, 2017 at 10:46:35 AM UTC-4, the.ultim...@gmail.com wrote:<blo=
ckquote 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><br>Le dimanc=
he 4 juin 2017 20:55:08 UTC+2, Todd Fleming 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">How do you propose handling nu=
meric stability issues?</div></blockquote><div><br>Could you elaborate on t=
hat ? I myself wonder why one cannot use at least a floating point literal =
as a template parameter argument. A floating point literal denotes (I belie=
ve) a single binary representation, and these binary representations can be=
 compared for identity. I believe (uncheckedly) that one can use long long =
template parameters, so it is not a problem of compiler capacity.<br></div>=
</div></blockquote></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/cd56a1aa-464c-498a-8675-06880f74879c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/cd56a1aa-464c-498a-8675-06880f74879c=
%40isocpp.org</a>.<br />

------=_Part_2735_403820303.1503673180166--

------=_Part_2734_674156597.1503673180165--

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Fri, 25 Aug 2017 11:26:57 -0400
Raw View
--089e0820d1849cfdc80557959477
Content-Type: text/plain; charset="UTF-8"

On Fri, Aug 25, 2017 at 10:59 AM, Todd Fleming <tbfleming@gmail.com> wrote:

> constexpr float a = 1.0f / 3.0f;
> Foo<a * 3.0f> obj1;
> Foo<1.0f> obj2 = obj1;
>
> Should the standard require:
> 1. obj1 and obj2 have the same type?
> 2. obj1 and obj2 have different types?
>

It's unspecified.  The Standard already covers this in [expr.const]:
*... it is unspecified whether the evaluation of a floating-point
expression during translation yields the same result as the evaluation of
the same expression (or the same operations on the same values) during
program execution.[84]*
*[84] Nonetheless, implementations are encouraged to provide consistent
results ...*

As a matter of QoI, they should be the same type if 1.0f / 3.0f * 3.0f ==
1.0f on the target platform (with forcing to memory):
    volatile float one = 1.0f;
    volatile float three = 3.0f;
    volatile float x = one;
    x /= three;
    x *= three;
    assert((x == one) == std::is_same(Foo<a * 3.0f>, Foo<1.0f>)::value);

--
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/CAHSYqdaMTcH7hnughyHP_ENvBxpy62RnC%3DrvNQr%3DyVa%3DMHer-A%40mail.gmail.com.

--089e0820d1849cfdc80557959477
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 F=
ri, Aug 25, 2017 at 10:59 AM, Todd Fleming <span dir=3D"ltr">&lt;<a href=3D=
"mailto:tbfleming@gmail.com" target=3D"_blank">tbfleming@gmail.com</a>&gt;<=
/span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=
=3D"ltr">constexpr float a =3D 1.0f / 3.0f;<div>Foo&lt;a * 3.0f&gt; obj1;</=
div><div>Foo&lt;1.0f&gt; obj2 =3D obj1;</div><div><br></div><div>Should the=
 standard require:</div><div>1. obj1 and obj2 have the same type?</div><div=
>2. obj1 and obj2 have different types?</div></div></blockquote><div><br></=
div><div>It&#39;s unspecified.=C2=A0 The Standard already covers this in [e=
xpr.const]:<br><i>... it is unspecified whether the evaluation of a floatin=
g-point expression during translation yields the same result as the evaluat=
ion of the same expression (or the same operations on the same values) duri=
ng program execution.[84]</i><br><i>[84]=C2=A0Nonetheless, implementations =
are encouraged to provide consistent results ...</i><br><br>As a matter of =
QoI, they should be the same type if <font face=3D"monospace, monospace">1.=
0f / 3.0f * 3.0f =3D=3D 1.0f</font><font face=3D"arial, helvetica, sans-ser=
if">=C2=A0on the target platform (with forcing to memory):</font><br><font =
face=3D"monospace, monospace">=C2=A0 =C2=A0 volatile float one =3D 1.0f;</f=
ont></div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 volatile f=
loat three =3D 3.0f;</font></div><div><font face=3D"monospace, monospace">=
=C2=A0 =C2=A0 volatile float x =3D one;</font></div><div><font face=3D"mono=
space, monospace">=C2=A0 =C2=A0 x /=3D three;</font></div><div><font face=
=3D"monospace, monospace">=C2=A0 =C2=A0 x *=3D three;</font></div><div><fon=
t face=3D"monospace, monospace">=C2=A0 =C2=A0 assert((x =3D=3D one) =3D=3D =
std::is_same(Foo&lt;a * 3.0f&gt;, Foo&lt;1.0f&gt;)::value);</font></div></d=
iv></div></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAHSYqdaMTcH7hnughyHP_ENvBxpy62RnC%3D=
rvNQr%3DyVa%3DMHer-A%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdaMTc=
H7hnughyHP_ENvBxpy62RnC%3DrvNQr%3DyVa%3DMHer-A%40mail.gmail.com</a>.<br />

--089e0820d1849cfdc80557959477--

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Fri, 25 Aug 2017 11:30:43 -0400
Raw View
--001a11474e8c0c75e4055795a23b
Content-Type: text/plain; charset="UTF-8"

On Fri, Aug 25, 2017 at 11:26 AM, Hyman Rosen <hyman.rosen@gmail.com> wrote:
>
>     assert((x == one) == std::is_same(Foo<a * 3.0f>, Foo<1.0f>)::value);
>

Er, I mean std::is_same<Foo<a * 3.0f>, Foo<1.0f>>::value.

--
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/CAHSYqdaCV46vK%3Df%3DLjSkW8frAa5%3Ddaj5zFfLuvetnj1UXSmsBA%40mail.gmail.com.

--001a11474e8c0c75e4055795a23b
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 F=
ri, Aug 25, 2017 at 11:26 AM, Hyman Rosen <span dir=3D"ltr">&lt;<a href=3D"=
mailto:hyman.rosen@gmail.com" target=3D"_blank">hyman.rosen@gmail.com</a>&g=
t;</span> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0=
px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=
=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote"><div><font f=
ace=3D"monospace, monospace">=C2=A0 =C2=A0 assert((x =3D=3D one) =3D=3D std=
::is_same(Foo&lt;a * 3.0f&gt;, Foo&lt;1.0f&gt;)::value);</font></div></div>=
</div></div>
</blockquote></div><br>Er, I mean=C2=A0<span style=3D"font-family:monospace=
,monospace">std::is_same&lt;Foo&lt;a * 3.0f&gt;, Foo&lt;1.0f&gt;&gt;::value=
</span><font face=3D"arial, helvetica, sans-serif">.</font></div></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAHSYqdaCV46vK%3Df%3DLjSkW8frAa5%3Dda=
j5zFfLuvetnj1UXSmsBA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdaCV4=
6vK%3Df%3DLjSkW8frAa5%3Ddaj5zFfLuvetnj1UXSmsBA%40mail.gmail.com</a>.<br />

--001a11474e8c0c75e4055795a23b--

.


Author: Todd Fleming <tbfleming@gmail.com>
Date: Fri, 25 Aug 2017 11:34:00 -0400
Raw View
--f4030436269e991b20055795acea
Content-Type: text/plain; charset="UTF-8"

That makes it unspecified whether the code will compile. Is there any
precedent for making it unspecified whether code will compile?


On Fri, Aug 25, 2017 at 11:26 AM, Hyman Rosen <hyman.rosen@gmail.com> wrote:

> On Fri, Aug 25, 2017 at 10:59 AM, Todd Fleming <tbfleming@gmail.com>
> wrote:
>
>> constexpr float a = 1.0f / 3.0f;
>> Foo<a * 3.0f> obj1;
>> Foo<1.0f> obj2 = obj1;
>>
>> Should the standard require:
>> 1. obj1 and obj2 have the same type?
>> 2. obj1 and obj2 have different types?
>>
>
> It's unspecified.  The Standard already covers this in [expr.const]:
> *... it is unspecified whether the evaluation of a floating-point
> expression during translation yields the same result as the evaluation of
> the same expression (or the same operations on the same values) during
> program execution.[84]*
> *[84] Nonetheless, implementations are encouraged to provide consistent
> results ...*
>
> As a matter of QoI, they should be the same type if 1.0f / 3.0f * 3.0f ==
> 1.0f on the target platform (with forcing to memory):
>     volatile float one = 1.0f;
>     volatile float three = 3.0f;
>     volatile float x = one;
>     x /= three;
>     x *= three;
>     assert((x == one) == std::is_same(Foo<a * 3.0f>, Foo<1.0f>)::value);
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/
> isocpp.org/d/topic/std-proposals/fr0rZiQdUgU/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAHSYqdaMTcH7hnughyHP_
> ENvBxpy62RnC%3DrvNQr%3DyVa%3DMHer-A%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdaMTcH7hnughyHP_ENvBxpy62RnC%3DrvNQr%3DyVa%3DMHer-A%40mail.gmail.com?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/CAD_mgProCD%2B-2rK60Q9rmi7z4_RZCYpzEJ4Wv3PcAE8HNGRfbQ%40mail.gmail.com.

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

<div dir=3D"ltr">That makes it unspecified whether the code will compile. I=
s there any precedent for making it unspecified whether code will compile?<=
div><br></div></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quot=
e">On Fri, Aug 25, 2017 at 11:26 AM, Hyman Rosen <span dir=3D"ltr">&lt;<a h=
ref=3D"mailto:hyman.rosen@gmail.com" target=3D"_blank">hyman.rosen@gmail.co=
m</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margi=
n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">=
<div class=3D"gmail_extra"><div class=3D"gmail_quote"><span class=3D"">On F=
ri, Aug 25, 2017 at 10:59 AM, Todd Fleming <span dir=3D"ltr">&lt;<a href=3D=
"mailto:tbfleming@gmail.com" target=3D"_blank">tbfleming@gmail.com</a>&gt;<=
/span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=
=3D"ltr">constexpr float a =3D 1.0f / 3.0f;<div>Foo&lt;a * 3.0f&gt; obj1;</=
div><div>Foo&lt;1.0f&gt; obj2 =3D obj1;</div><div><br></div><div>Should the=
 standard require:</div><div>1. obj1 and obj2 have the same type?</div><div=
>2. obj1 and obj2 have different types?</div></div></blockquote><div><br></=
div></span><div>It&#39;s unspecified.=C2=A0 The Standard already covers thi=
s in [expr.const]:<br><i>... it is unspecified whether the evaluation of a =
floating-point expression during translation yields the same result as the =
evaluation of the same expression (or the same operations on the same value=
s) during program execution.[84]</i><br><i>[84]=C2=A0Nonetheless, implement=
ations are encouraged to provide consistent results ...</i><br><br>As a mat=
ter of QoI, they should be the same type if <font face=3D"monospace, monosp=
ace">1.0f / 3.0f * 3.0f =3D=3D 1.0f</font><font face=3D"arial, helvetica, s=
ans-serif">=C2=A0on the target platform (with forcing to memory):</font><br=
><font face=3D"monospace, monospace">=C2=A0 =C2=A0 volatile float one =3D 1=
..0f;</font></div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 vol=
atile float three =3D 3.0f;</font></div><div><font face=3D"monospace, monos=
pace">=C2=A0 =C2=A0 volatile float x =3D one;</font></div><div><font face=
=3D"monospace, monospace">=C2=A0 =C2=A0 x /=3D three;</font></div><div><fon=
t face=3D"monospace, monospace">=C2=A0 =C2=A0 x *=3D three;</font></div><di=
v><font face=3D"monospace, monospace">=C2=A0 =C2=A0 assert((x =3D=3D one) =
=3D=3D std::is_same(Foo&lt;a * 3.0f&gt;, Foo&lt;1.0f&gt;)::value);</font></=
div></div></div></div><span class=3D"">

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/fr0rZiQdUgU/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/<wbr>isocpp.org/d/topic/std-<wbr>proposals/f=
r0rZiQdUgU/<wbr>unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@<wbr>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></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAHSYqdaMTcH7hnughyHP_ENvBxpy62RnC%3D=
rvNQr%3DyVa%3DMHer-A%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Df=
ooter" target=3D"_blank">https://groups.google.com/a/<wbr>isocpp.org/d/msgi=
d/std-<wbr>proposals/<wbr>CAHSYqdaMTcH7hnughyHP_<wbr>ENvBxpy62RnC%3DrvNQr%3=
DyVa%<wbr>3DMHer-A%40mail.gmail.com</a>.<br>
</blockquote></div><br></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAD_mgProCD%2B-2rK60Q9rmi7z4_RZCYpzEJ=
4Wv3PcAE8HNGRfbQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAD_mgProCD%2B-=
2rK60Q9rmi7z4_RZCYpzEJ4Wv3PcAE8HNGRfbQ%40mail.gmail.com</a>.<br />

--f4030436269e991b20055795acea--

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Fri, 25 Aug 2017 11:55:28 -0400
Raw View
--001a114afa2c9d1aed055795fadf
Content-Type: text/plain; charset="UTF-8"

On Fri, Aug 25, 2017 at 11:34 AM, Todd Fleming <tbfleming@gmail.com> wrote:

> That makes it unspecified whether the code will compile. Is there any
> precedent for making it unspecified whether code will compile?
>

I don't understand your question.

You can already have the following code

    char buf[2 * (1.0f / 3.0f * 3.0f == 1.0f) - 1];

which will compile or not based on the same evaluation issues.  Is that
what you mean?

--
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/CAHSYqdYMFd9cOaoA-4X5UgxX%3DOn%2BY4XZge2KVrqH17yA9pgULg%40mail.gmail.com.

--001a114afa2c9d1aed055795fadf
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 F=
ri, Aug 25, 2017 at 11:34 AM, Todd Fleming <span dir=3D"ltr">&lt;<a href=3D=
"mailto:tbfleming@gmail.com" target=3D"_blank">tbfleming@gmail.com</a>&gt;<=
/span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">That makes=
 it unspecified whether the code will compile. Is there any precedent for m=
aking it unspecified whether code will compile?</div></blockquote><div><br>=
I don&#39;t understand your question.<br><br>You can already have the follo=
wing code<br><br><font face=3D"monospace, monospace">=C2=A0 =C2=A0 char buf=
[2 * (1.0f / 3.0f * 3.0f =3D=3D 1.0f) - 1];<br></font><font face=3D"arial, =
helvetica, sans-serif"><br>which will compile or not based on the same eval=
uation issues.=C2=A0 Is that what you mean?</font>=C2=A0</div></div></div><=
/div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAHSYqdYMFd9cOaoA-4X5UgxX%3DOn%2BY4XZ=
ge2KVrqH17yA9pgULg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdYMFd9c=
OaoA-4X5UgxX%3DOn%2BY4XZge2KVrqH17yA9pgULg%40mail.gmail.com</a>.<br />

--001a114afa2c9d1aed055795fadf--

.


Author: Todd Fleming <tbfleming@gmail.com>
Date: Fri, 25 Aug 2017 12:02:12 -0400
Raw View
--001a114400306db6e50557961157
Content-Type: text/plain; charset="UTF-8"

Yes. That's it. You found a precedent.

On Fri, Aug 25, 2017 at 11:55 AM, Hyman Rosen <hyman.rosen@gmail.com> wrote:

> On Fri, Aug 25, 2017 at 11:34 AM, Todd Fleming <tbfleming@gmail.com>
> wrote:
>
>> That makes it unspecified whether the code will compile. Is there any
>> precedent for making it unspecified whether code will compile?
>>
>
> I don't understand your question.
>
> You can already have the following code
>
>     char buf[2 * (1.0f / 3.0f * 3.0f == 1.0f) - 1];
>
> which will compile or not based on the same evaluation issues.  Is that
> what you mean?
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/
> isocpp.org/d/topic/std-proposals/fr0rZiQdUgU/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAHSYqdYMFd9cOaoA-4X5UgxX%3DOn%
> 2BY4XZge2KVrqH17yA9pgULg%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdYMFd9cOaoA-4X5UgxX%3DOn%2BY4XZge2KVrqH17yA9pgULg%40mail.gmail.com?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/CAD_mgPqEmpDq8%2BjCkKwL4RGZRTVkYokEtj26Z3tHwGVGN6UgdQ%40mail.gmail.com.

--001a114400306db6e50557961157
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Yes. That&#39;s it. You found a precedent.<div><br></div><=
div class=3D"gmail_extra"><div class=3D"gmail_quote">On Fri, Aug 25, 2017 a=
t 11:55 AM, Hyman Rosen <span dir=3D"ltr">&lt;<a href=3D"mailto:hyman.rosen=
@gmail.com" target=3D"_blank">hyman.rosen@gmail.com</a>&gt;</span> wrote:<b=
r><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 class=3D"gmail_extra=
"><div class=3D"gmail_quote"><span class=3D"">On Fri, Aug 25, 2017 at 11:34=
 AM, Todd Fleming <span dir=3D"ltr">&lt;<a href=3D"mailto:tbfleming@gmail.c=
om" target=3D"_blank">tbfleming@gmail.com</a>&gt;</span> wrote:<br><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><div dir=3D"ltr">That makes it unspecified whether t=
he code will compile. Is there any precedent for making it unspecified whet=
her code will compile?</div></blockquote></span><div><br>I don&#39;t unders=
tand your question.<br><br>You can already have the following code<br><br><=
font face=3D"monospace, monospace">=C2=A0 =C2=A0 char buf[2 * (1.0f / 3.0f =
* 3.0f =3D=3D 1.0f) - 1];<br></font><font face=3D"arial, helvetica, sans-se=
rif"><br>which will compile or not based on the same evaluation issues.=C2=
=A0 Is that what you mean?</font>=C2=A0</div></div></div></div><span class=
=3D"">

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/fr0rZiQdUgU/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/<wbr>isocpp.org/d/topic/std-<wbr>proposals/f=
r0rZiQdUgU/<wbr>unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@<wbr>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></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAHSYqdYMFd9cOaoA-4X5UgxX%3DOn%2BY4XZ=
ge2KVrqH17yA9pgULg%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfoo=
ter" target=3D"_blank">https://groups.google.com/a/<wbr>isocpp.org/d/msgid/=
std-<wbr>proposals/CAHSYqdYMFd9cOaoA-<wbr>4X5UgxX%3DOn%<wbr>2BY4XZge2KVrqH1=
7yA9pgULg%<wbr>40mail.gmail.com</a>.<br>
</blockquote></div><br></div></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAD_mgPqEmpDq8%2BjCkKwL4RGZRTVkYokEtj=
26Z3tHwGVGN6UgdQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAD_mgPqEmpDq8%=
2BjCkKwL4RGZRTVkYokEtj26Z3tHwGVGN6UgdQ%40mail.gmail.com</a>.<br />

--001a114400306db6e50557961157--

.


Author: Justin Bassett <jbassett271@gmail.com>
Date: Fri, 25 Aug 2017 09:08:00 -0700
Raw View
--001a113e7a6a36c0a605579626d0
Content-Type: text/plain; charset="UTF-8"

Nicol already pointed out how floats as template parameters can make the
type system awkward. We don't want a confusing type system.

I can think of only 2 reasons to want floats as template parameters:
compile-time computation and constants. For computation, just use constexpr
functions. For constants, use optimizers. Optimizers should handle the case
of constants well. I know they do for function parameters, but maybe not so
well for member variables (though it at least should in the future).

I don't see how adding floats as non-type template parameters brings more
benefit than harm. We need to be able to reason about whether two types are
equal.

On Aug 25, 2017 9:55 AM, "Hyman Rosen" <hyman.rosen@gmail.com> wrote:

> On Fri, Aug 25, 2017 at 11:34 AM, Todd Fleming <tbfleming@gmail.com>
> wrote:
>
>> That makes it unspecified whether the code will compile. Is there any
>> precedent for making it unspecified whether code will compile?
>>
>
> I don't understand your question.
>
> You can already have the following code
>
>     char buf[2 * (1.0f / 3.0f * 3.0f == 1.0f) - 1];
>
> which will compile or not based on the same evaluation issues.  Is that
> what you mean?
>
> --
> 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/CAHSYqdYMFd9cOaoA-4X5UgxX%3DOn%
> 2BY4XZge2KVrqH17yA9pgULg%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdYMFd9cOaoA-4X5UgxX%3DOn%2BY4XZge2KVrqH17yA9pgULg%40mail.gmail.com?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/CAPuuy5eh9iJy_Y3Q88SNZ1QskKLyLWp%3DsxQ_w056MOOk7rjynw%40mail.gmail.com.

--001a113e7a6a36c0a605579626d0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Nicol already pointed out how floats as template paramete=
rs can make the type system awkward. We don&#39;t want a confusing type sys=
tem.<div dir=3D"auto"><br></div><div dir=3D"auto">I can think of only 2 rea=
sons to want floats as template parameters: compile-time computation and co=
nstants. For computation, just use constexpr functions. For constants, use =
optimizers. Optimizers should handle the case of constants well. I know the=
y do for function parameters, but maybe not so well for member variables (t=
hough it at least should in the future).</div><div dir=3D"auto"><br></div><=
div dir=3D"auto">I don&#39;t see how adding floats as non-type template par=
ameters brings more benefit than harm. We need to be able to reason about w=
hether two types are equal.</div></div><div class=3D"gmail_extra"><br><div =
class=3D"gmail_quote">On Aug 25, 2017 9:55 AM, &quot;Hyman Rosen&quot; &lt;=
<a href=3D"mailto:hyman.rosen@gmail.com">hyman.rosen@gmail.com</a>&gt; wrot=
e:<br type=3D"attribution"><blockquote class=3D"gmail_quote" style=3D"margi=
n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">=
<div class=3D"gmail_extra"><div class=3D"gmail_quote">On Fri, Aug 25, 2017 =
at 11:34 AM, Todd Fleming <span dir=3D"ltr">&lt;<a href=3D"mailto:tbfleming=
@gmail.com" target=3D"_blank">tbfleming@gmail.com</a>&gt;</span> wrote:<br>=
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">That makes it unspecified w=
hether the code will compile. Is there any precedent for making it unspecif=
ied whether code will compile?</div></blockquote><div><br>I don&#39;t under=
stand your question.<br><br>You can already have the following code<br><br>=
<font face=3D"monospace, monospace">=C2=A0 =C2=A0 char buf[2 * (1.0f / 3.0f=
 * 3.0f =3D=3D 1.0f) - 1];<br></font><font face=3D"arial, helvetica, sans-s=
erif"><br>which will compile or not based on the same evaluation issues.=C2=
=A0 Is that what you mean?</font>=C2=A0</div></div></div></div>

<p></p>

-- <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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>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/CAHSYqdYMFd9cOaoA-4X5UgxX%3DOn%2BY4XZ=
ge2KVrqH17yA9pgULg%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfoo=
ter" target=3D"_blank">https://groups.google.com/a/<wbr>isocpp.org/d/msgid/=
std-<wbr>proposals/CAHSYqdYMFd9cOaoA-<wbr>4X5UgxX%3DOn%<wbr>2BY4XZge2KVrqH1=
7yA9pgULg%<wbr>40mail.gmail.com</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&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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAPuuy5eh9iJy_Y3Q88SNZ1QskKLyLWp%3Dsx=
Q_w056MOOk7rjynw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPuuy5eh9iJy_Y=
3Q88SNZ1QskKLyLWp%3DsxQ_w056MOOk7rjynw%40mail.gmail.com</a>.<br />

--001a113e7a6a36c0a605579626d0--

.