Topic: Type of number literals deduction (for size)


Author: Patryk W <spartanpageagain@gmail.com>
Date: Sun, 21 Dec 2014 14:29:27 -0800 (PST)
Raw View
------=_Part_466_1953235175.1419200967374
Content-Type: multipart/alternative;
 boundary="----=_Part_467_1588558183.1419200967374"

------=_Part_467_1588558183.1419200967374
Content-Type: text/plain; charset=UTF-8

Result of this <http://ideone.com/5yx7Uw> isn't really rewarding.
#include <iostream>
int main(){
    auto value = 10000000*1000;
    std::cout << value;
}
It would be nice if compilers could handle it without any problems.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<div dir=3D"ltr">Result of <a href=3D"http://ideone.com/5yx7Uw">this</a> is=
n't really rewarding.<br><div class=3D"prettyprint" style=3D"background-col=
or: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: sol=
id; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint">=
<div class=3D"subprettyprint"><span style=3D"color: #800;" class=3D"styled-=
by-prettify">#include</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify=
">&lt;iostream&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> main=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(){</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp;=
 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> value </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #066;" class=3D"styled-by-prettify">10000000</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">*</span><span style=3D"color: #066;"=
 class=3D"styled-by-prettify">1000</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>&nbsp; &nbsp; std</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">cout </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> value</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span>=
</div></code></div><span id=3D"result_box" class=3D"short_text" lang=3D"en"=
><span class=3D"hps">It would be nice if compilers could handle it without =
any problems.</span></span><span id=3D"result_box" class=3D"short_text" lan=
g=3D"en"><span class=3D"hps"><br></span></span></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_467_1588558183.1419200967374--
------=_Part_466_1953235175.1419200967374--

.


Author: David Krauss <potswa@gmail.com>
Date: Mon, 22 Dec 2014 08:57:23 +0800
Raw View
--Apple-Mail=_E0B36C71-7A63-4DE3-9EA7-3A92866EF449
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2014=E2=80=9312=E2=80=9322, at 6:29 AM, Patryk W <spartanpageagain@gma=
il.com> wrote:
>=20
> Result of this <http://ideone.com/5yx7Uw> isn't really rewarding.
> #include <iostream>
> int main(){
>     auto value =3D 10000000*1000;
>     std::cout << value;
> }
> It would be nice if compilers could handle it without any problems.

Try enabling warnings with -Wall.

warning: overflow in expression; result is 1410065408 with type 'int'

http://coliru.stacked-crooked.com/a/fe6ccddc1283aa5b <http://coliru.stacked=
-crooked.com/a/fe6ccddc1283aa5b>

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_E0B36C71-7A63-4DE3-9EA7-3A92866EF449
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2014=E2=80=9312=
=E2=80=9322, at 6:29 AM, Patryk W &lt;<a href=3D"mailto:spartanpageagain@gm=
ail.com" class=3D"">spartanpageagain@gmail.com</a>&gt; wrote:</div><br clas=
s=3D"Apple-interchange-newline"><div class=3D""><div dir=3D"ltr" class=3D""=
>Result of <a href=3D"http://ideone.com/5yx7Uw" class=3D"">this</a> isn't r=
eally rewarding.<br class=3D""><div class=3D"prettyprint" style=3D"backgrou=
nd-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-styl=
e: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyp=
rint"><span style=3D"color: #800;" class=3D"styled-by-prettify">#include</s=
pan> <span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;iostream=
&gt;</span><br class=3D""><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">int</span> main<span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">(){</span><br class=3D"">&nbsp; &nbsp; <span style=3D"color: #008;" =
class=3D"styled-by-prettify">auto</span> value <span style=3D"color: #660;"=
 class=3D"styled-by-prettify">=3D</span> <span style=3D"color: #066;" class=
=3D"styled-by-prettify">10000000</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">*</span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">1000</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">;</span><br class=3D"">&nbsp; &nbsp; std<span style=3D"color: #660=
;" class=3D"styled-by-prettify">::</span>cout <span style=3D"color: #660;" =
class=3D"styled-by-prettify">&lt;&lt;</span> value<span style=3D"color: #66=
0;" class=3D"styled-by-prettify">;</span><br class=3D""><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">}</span></code></div><span id=3D"res=
ult_box" class=3D"short_text" lang=3D"en">It would be nice if compilers cou=
ld handle it without any problems.</span><span id=3D"result_box" class=3D"s=
hort_text" lang=3D"en"><br class=3D""></span></div></div></blockquote><br c=
lass=3D""></div><div>Try enabling warnings with -Wall.</div><div><br class=
=3D""></div><div><pre class=3D"f0" style=3D"margin-top: 0px; margin-bottom:=
 0px; padding: 0px; cursor: auto;">warning: overflow in expression; result =
is 1410065408 with type 'int'</pre></div><div><br class=3D""></div><div><a =
href=3D"http://coliru.stacked-crooked.com/a/fe6ccddc1283aa5b" class=3D"">ht=
tp://coliru.stacked-crooked.com/a/fe6ccddc1283aa5b</a></div></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_E0B36C71-7A63-4DE3-9EA7-3A92866EF449--

.


Author: Patryk W <spartanpageagain@gmail.com>
Date: Sun, 21 Dec 2014 18:07:08 -0800 (PST)
Raw View
------=_Part_2187_2117118695.1419214028592
Content-Type: multipart/alternative;
 boundary="----=_Part_2188_757359722.1419214028592"

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

I know that it generates warning, but in 2015 why do we have to care about=
=20
a numeric literal size?
I don't feel any better by being forced to use special sufixes for bigger=
=20
literals. Why do i have to track when number is getting larger?
Like here:
#include <iostream>

int main() {
    auto first  =3D 1000*1000;
    auto second =3D 100000*1000;
    auto third  =3D 10000000*1000;
    std::cout << first << ' ' << second << ' ' << third;
}


W dniu poniedzia=C5=82ek, 22 grudnia 2014 01:57:36 UTC+1 u=C5=BCytkownik Da=
vid Krauss=20
napisa=C5=82:
>
>
> On 2014=E2=80=9312=E2=80=9322, at 6:29 AM, Patryk W <spartanp...@gmail.co=
m <javascript:>>=20
> wrote:
>
> Result of this <http://ideone.com/5yx7Uw> isn't really rewarding.
> #include <iostream>
> int main(){
>     auto value =3D 10000000*1000;
>     std::cout << value;
> }
> It would be nice if compilers could handle it without any problems.
>
>
> Try enabling warnings with -Wall.
>
> warning: overflow in expression; result is 1410065408 with type 'int'
>
>
> http://coliru.stacked-crooked.com/a/fe6ccddc1283aa5b
>

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

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

<div dir=3D"ltr">I know that it generates warning, but in 2015 why do we ha=
ve to care about a numeric literal size?<br>I don't feel any better by bein=
g forced to use special sufixes for bigger literals. Why do i have to track=
 when number is getting larger?<br>Like here:<br><div class=3D"prettyprint"=
 style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187,=
 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><cod=
e class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color:=
 #800;" class=3D"styled-by-prettify">#include</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" cla=
ss=3D"styled-by-prettify">&lt;iostream&gt;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> main</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">()</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nb=
sp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>auto</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> firs=
t &nbsp;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #066;" class=3D"styled-by-prettify">1000</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span style=3D=
"color: #066;" class=3D"styled-by-prettify">1000</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> second </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">100000</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">*</span><span style=3D"color: #066;" class=3D"styled-by-prettify=
">1000</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &n=
bsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> third &nbs=
p;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #066;" class=3D"styled-by-prettify">10000000</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">*</span><span style=3D"col=
or: #066;" class=3D"styled-by-prettify">1000</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>&nbsp; &nbsp; std</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">cout </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> first </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-=
prettify">' '</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&l=
t;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> second =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #080;" class=3D"styled-by-prettify">' '</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> third</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><br>W dniu poniedzia=C5=82=
ek, 22 grudnia 2014 01:57:36 UTC+1 u=C5=BCytkownik David Krauss napisa=C5=
=82:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex=
;border-left: 1px #ccc solid;padding-left: 1ex;"><div style=3D"word-wrap:br=
eak-word"><br><div><blockquote type=3D"cite"><div>On 2014=E2=80=9312=E2=80=
=9322, at 6:29 AM, Patryk W &lt;<a href=3D"javascript:" target=3D"_blank" g=
df-obfuscated-mailto=3D"Dp9SC9yUYGwJ" onmousedown=3D"this.href=3D'javascrip=
t:';return true;" onclick=3D"this.href=3D'javascript:';return true;">sparta=
np...@gmail.com</a>&gt; wrote:</div><br><div><div dir=3D"ltr">Result of <a =
href=3D"http://ideone.com/5yx7Uw" target=3D"_blank" onmousedown=3D"this.hre=
f=3D'http://www.google.com/url?q\75http%3A%2F%2Fideone.com%2F5yx7Uw\46sa\75=
D\46sntz\0751\46usg\75AFQjCNHna04aFA63_FGovLa7BDTbhX7XMA';return true;" onc=
lick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fideone.com%=
2F5yx7Uw\46sa\75D\46sntz\0751\46usg\75AFQjCNHna04aFA63_FGovLa7BDTbhX7XMA';r=
eturn true;">this</a> isn't really rewarding.<br><div style=3D"background-c=
olor:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bord=
er-width:1px;word-wrap:break-word"><code><span style=3D"color:#800">#includ=
e</span> <span style=3D"color:#080">&lt;iostream&gt;</span><br><span style=
=3D"color:#008">int</span> main<span style=3D"color:#660">(){</span><br>&nb=
sp; &nbsp; <span style=3D"color:#008">auto</span> value <span style=3D"colo=
r:#660">=3D</span> <span style=3D"color:#066">10000000</span><span style=3D=
"color:#660">*</span><span style=3D"color:#066">1000</span><span style=3D"c=
olor:#660">;</span><br>&nbsp; &nbsp; std<span style=3D"color:#660">::</span=
>cout <span style=3D"color:#660">&lt;&lt;</span> value<span style=3D"color:=
#660">;</span><br><span style=3D"color:#660">}</span></code></div><span lan=
g=3D"en">It would be nice if compilers could handle it without any problems=
..</span><span lang=3D"en"><br></span></div></div></blockquote><br></div><di=
v>Try enabling warnings with -Wall.</div><div><br></div><div><pre style=3D"=
margin-top:0px;margin-bottom:0px;padding:0px">warning: overflow in expressi=
on; result is 1410065408 with type 'int'</pre></div><div><br></div><div><a =
href=3D"http://coliru.stacked-crooked.com/a/fe6ccddc1283aa5b" target=3D"_bl=
ank" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2=
Fcoliru.stacked-crooked.com%2Fa%2Ffe6ccddc1283aa5b\46sa\75D\46sntz\0751\46u=
sg\75AFQjCNGxvp-5vP3hAU28e_ELtfBSzimGTw';return true;" onclick=3D"this.href=
=3D'http://www.google.com/url?q\75http%3A%2F%2Fcoliru.stacked-crooked.com%2=
Fa%2Ffe6ccddc1283aa5b\46sa\75D\46sntz\0751\46usg\75AFQjCNGxvp-5vP3hAU28e_EL=
tfBSzimGTw';return true;">http://coliru.stacked-crooked.<wbr>com/a/fe6ccddc=
1283aa5b</a></div></div></blockquote></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_2188_757359722.1419214028592--
------=_Part_2187_2117118695.1419214028592--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Sun, 21 Dec 2014 18:18:11 -0800
Raw View
On Sunday 21 December 2014 18:07:08 Patryk W wrote:
> I know that it generates warning, but in 2015 why do we have to care about
> a numeric literal size?

Because it isn't a literal problem. It's a multiplication overflow problem, one
that will not go away unless we have arbitrary-precision numbers and we don't.

> I don't feel any better by being forced to use special sufixes for bigger
> literals. Why do i have to track when number is getting larger?

Because multiplications always increase the size. If you don't want to worry
about this, don't multiply. In fact, don't add either, since you'll need at
least one more bit than the largest of the two numbers.

> Like here:
> #include <iostream>
>
> int main() {
>     auto first  = 1000*1000;
>     auto second = 100000*1000;
>     auto third  = 10000000*1000;
>     std::cout << first << ' ' << second << ' ' << third;
> }

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Patryk W <spartanpageagain@gmail.com>
Date: Sun, 21 Dec 2014 18:37:40 -0800 (PST)
Raw View
------=_Part_2448_587230878.1419215860756
Content-Type: multipart/alternative;
 boundary="----=_Part_2449_1902008581.1419215860756"

------=_Part_2449_1902008581.1419215860756
Content-Type: text/plain; charset=UTF-8



> least one more bit than the largest of the two numbers.

Of course. But why not use bigger number for that kind of operations? It's
not a shame to cut it later.
Like here:

#include <iostream>
#define N(x) x##ll
int main() {
    int32_t first  = N(1000)*N(1000);
    int32_t second = N(100000)*N(1000);
    //Only in this case warning is really necessary;
    //Not becouse of the type used for multiplication,
    //but becouse of the type used for storaging the result!
    int32_t third  = N(10000000)*N(1000);
    std::cout << first << ' ' << second << ' ' << third;
}
Here is my point.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<div dir=3D"ltr"><br><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border=
-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quo=
te">least one more bit than the largest of the two numbers.
</blockquote><div>Of course. But why not use bigger number for that kind of=
 operations? It's not a shame to cut it later.<br>Like here:<br><br><div cl=
ass=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-c=
olor: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap=
: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><s=
pan style=3D"color: #800;" class=3D"styled-by-prettify">#include</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">&lt;iostream&gt;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">#define</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> N</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">x</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> x</span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>##ll</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> main</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">()</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>&nbsp; &nbsp; int32_t first &nbsp;</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> N</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #066;"=
 class=3D"styled-by-prettify">1000</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)*</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">N</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">(</span><span style=3D"color: #066;" class=3D"styled-by-prettify">10=
00</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp=
; int32_t second </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 N</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span>=
<span style=3D"color: #066;" class=3D"styled-by-prettify">100000</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">)*</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">N</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #066;" =
class=3D"styled-by-prettify">1000</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">//Only in this case warning is really necessary; </=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &=
nbsp; </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//No=
t becouse of the type used for multiplication,</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D=
"color: #800;" class=3D"styled-by-prettify">//but becouse of the type used =
for storaging the result!</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>&nbsp; &nbsp; int32_t third &nbsp;</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> N</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #066;" class=3D"s=
tyled-by-prettify">10000000</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">)*</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">N</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #066;" class=3D"styled-by-prettify">1000</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> <br>&nbsp; &nbsp; std<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">cout </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> first </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #080;" class=3D"styled-by-prettify">' '</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> second </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=3D"style=
d-by-prettify">' '</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&=
lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> th=
ird</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>H=
ere is my point.<br></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_2449_1902008581.1419215860756--
------=_Part_2448_587230878.1419215860756--

.


Author: Patryk W <spartanpageagain@gmail.com>
Date: Sun, 21 Dec 2014 18:54:19 -0800 (PST)
Raw View
------=_Part_2182_341422947.1419216859510
Content-Type: multipart/alternative;
 boundary="----=_Part_2183_219165445.1419216859510"

------=_Part_2183_219165445.1419216859510
Content-Type: text/plain; charset=UTF-8

I mean, in my perfect world this:
#include <type_traits>
#include <iostream>
using namespace std;
int main(){
    cout << is_same<int, decltype(1)>::value
          + is_same<int, decltype(100000*1000)>::value
          + is_same<long, decltype(10000000*1000)>::value;
}
gives *3*

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<div dir=3D"ltr">I mean, in my perfect world this:<br><div class=3D"prettyp=
rint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187,=
 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"=
><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"c=
olor: #800;" class=3D"styled-by-prettify">#include</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;=
" class=3D"styled-by-prettify">&lt;type_traits&gt;</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #8=
00;" class=3D"styled-by-prettify">#include</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=
=3D"styled-by-prettify">&lt;iostream&gt;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">namespace</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> main</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">(){</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; cout </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> is_same</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">decltype</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">1</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">)&gt;::</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">value<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">+</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> is_same</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">int</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">declt=
ype</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #066;" class=3D"styled-by-prettify">100000</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">1000</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">)&gt;::</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">value<br>&nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">+</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> is_same</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">long</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">decltype</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">(</span><span style=3D"color: #066;" class=3D"=
styled-by-prettify">10000000</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">*</span><span style=3D"color: #066;" class=3D"styled-by-p=
rettify">1000</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">)&gt;::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
value</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></code=
></div><div style=3D"text-align: left;">gives <b><u><code>3</code></u></b><=
br><br></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_2183_219165445.1419216859510--
------=_Part_2182_341422947.1419216859510--

.


Author: David Krauss <potswa@gmail.com>
Date: Mon, 22 Dec 2014 11:42:51 +0800
Raw View
--Apple-Mail=_6583F920-D73D-44EC-B26E-E236873CB321
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2014=E2=80=9312=E2=80=9322, at 10:54 AM, Patryk W <spartanpageagain@gm=
ail.com> wrote:
>=20
> I mean, in my perfect world this:
> #include <type_traits>
> #include <iostream>
> using namespace std;
> int main(){
>     cout << is_same<int, decltype(1)>::value
>           + is_same<int, decltype(100000*1000)>::value
>           + is_same<long, decltype(10000000*1000)>::value;
> }
> gives 3

What if long is 32-bit and int is 16-bit?

I think it would be good to explicitly allow compile-time evaluation of ari=
thmetic constant expressions, so implementations are allowed to flag compil=
e-time errors in such cases. Currently, the as-if rule provides for runtime=
 undefined behavior: your previous examples can actually crash when computi=
ng third, and furthermore they can compute third before doing anything else=
.. But they are still well-formed, because no undefined behavior occurs unti=
l the program is actually run.

Bumping up the size of integer constant expressions as if they were all lit=
erals would require diagnosis when the largest integer type is insufficient=
 (=C2=A72.14.2/3 [lex.icon]). That would probably be the most elegant reali=
zation of your idea. It would be very confusing for existing libraries base=
d on reasoning about integer types, though, and experienced users who write=
 such.

Also, note that unsigned types never overflow and such fixes are inapplicab=
le.

By the way, as for multiplication, you can define your own semantics with a=
 suffix operator (e.g., operator "" _kilo), including trapping overflows an=
d (with a literal operator template) bumping up the type to avoid overflows=
, regardless of signedness.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_6583F920-D73D-44EC-B26E-E236873CB321
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2014=E2=80=9312=
=E2=80=9322, at 10:54 AM, Patryk W &lt;<a href=3D"mailto:spartanpageagain@g=
mail.com" class=3D"">spartanpageagain@gmail.com</a>&gt; wrote:</div><br cla=
ss=3D"Apple-interchange-newline"><div class=3D""><div dir=3D"ltr" class=3D"=
">I mean, in my perfect world this:<br class=3D""><div class=3D"prettyprint=
" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187=
, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><co=
de class=3D"prettyprint"><span style=3D"color: #800;" class=3D"styled-by-pr=
ettify">#include</span> <span style=3D"color: #080;" class=3D"styled-by-pre=
ttify">&lt;type_traits&gt;</span><br class=3D""><span style=3D"color: #800;=
" class=3D"styled-by-prettify">#include</span> <span style=3D"color: #080;"=
 class=3D"styled-by-prettify">&lt;iostream&gt;</span><br class=3D""><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">using</span> <span style=
=3D"color: #008;" class=3D"styled-by-prettify">namespace</span> std<span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><br class=3D""><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">int</span> main<spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">(){</span><br class=
=3D"">&nbsp; &nbsp; cout <span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&lt;&lt;</span> is_same<span style=3D"color: #660;" class=3D"styled=
-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,</span> <span style=3D"color: #008;" class=3D"styled-by-prettify">decltyp=
e</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><=
span style=3D"color: #066;" class=3D"styled-by-prettify">1</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)&gt;::</span>value<br clas=
s=3D"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">+</span> is_same<span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">int</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">,</span> <span style=3D"color: #008;" class=3D"styled-by-prettif=
y">decltype</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>(</span><span style=3D"color: #066;" class=3D"styled-by-prettify">100000</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><spa=
n style=3D"color: #066;" class=3D"styled-by-prettify">1000</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)&gt;::</span>value<br clas=
s=3D"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">+</span> is_same<span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">long</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,</span> <span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">decltype</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(</span><span style=3D"color: #066;" class=3D"styled-by-prettify">1000000=
0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><=
span style=3D"color: #066;" class=3D"styled-by-prettify">1000</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">)&gt;::</span>value<span=
 style=3D"color: #660;" class=3D"styled-by-prettify">;</span><br class=3D""=
><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span></code><=
/div><div style=3D"text-align: left;" class=3D"">gives <b class=3D""><u cla=
ss=3D""><code class=3D"">3</code></u></b><br class=3D""></div></div></div><=
/blockquote><div><br class=3D""></div><div>What if <font face=3D"Courier" c=
lass=3D"">long</font> is 32-bit and <font face=3D"Courier" class=3D"">int</=
font> is 16-bit?</div><div><br class=3D""></div><div>I think it would be go=
od to explicitly allow compile-time evaluation of arithmetic constant expre=
ssions, so implementations are allowed to flag compile-time errors in such =
cases. Currently, the as-if rule provides for runtime undefined behavior: y=
our previous examples can actually crash when computing <font face=3D"Couri=
er" class=3D"">third</font>, and furthermore they can compute <font face=3D=
"Courier" class=3D"">third</font> before doing anything else. But they are =
still well-formed, because no undefined behavior occurs until the program i=
s actually run.</div><div><br class=3D""></div><div>Bumping up the size of =
integer constant expressions as if they were all literals would require dia=
gnosis when the largest integer type is insufficient (=C2=A72.14.2/3 [lex.i=
con]). That would probably be the most elegant realization of your idea. It=
 would be very confusing for existing libraries based on reasoning about in=
teger types, though, and experienced users who write such.</div><div><br cl=
ass=3D""></div><div>Also, note that unsigned types never overflow and such =
fixes are inapplicable.</div><div><br class=3D""></div><div>By the way, as =
for multiplication, you can define your own semantics with a suffix operato=
r (e.g., <font face=3D"Courier" class=3D"">operator "" _kilo</font>), inclu=
ding trapping overflows and (with a literal operator template) bumping up t=
he type to avoid overflows, regardless of signedness.</div></div></body></h=
tml>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_6583F920-D73D-44EC-B26E-E236873CB321--

.


Author: Patryk W <spartanpageagain@gmail.com>
Date: Mon, 22 Dec 2014 01:57:41 -0800 (PST)
Raw View
------=_Part_2639_797049354.1419242261153
Content-Type: multipart/alternative;
 boundary="----=_Part_2640_5502692.1419242261153"

------=_Part_2640_5502692.1419242261153
Content-Type: text/plain; charset=UTF-8



> It would be very confusing for existing libraries based on reasoning about
> integer types, though, and experienced users who write such.
> I was thinking of what can go wrong; This didn't come to my mind.
>


> By the way, as for multiplication, you can define your own semantics with
> a suffix operator (e.g., operator "" _kilo), including trapping overflows
> and (with a literal operator template) bumping up the type to avoid
> overflows, regardless of signedness.

Yes, of course i thought about that, but in my mind it wasn't enough;


Thank you very much for your time,
i get that it wouldn't be as nice as it was supposed to be.

Kindest regards, Patryk.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<div dir=3D"ltr"><br><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border=
-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quo=
te">It would be very confusing for existing libraries based on=20
reasoning about integer types, though, and experienced users who write=20
such.<div>I was thinking of what can go wrong; This didn't come to my mind.=
<br></div></blockquote><div>&nbsp;<br><blockquote style=3D"margin: 0px 0px =
0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" c=
lass=3D"gmail_quote">By the way, as for multiplication, you can define your=
 own semantics with a suffix operator (e.g., <font face=3D"Courier">operato=
r "" _kilo</font>),
 including trapping overflows and (with a literal operator template)=20
bumping up the type to avoid overflows, regardless of signedness.</blockquo=
te><div>Yes, of course i thought about that, but in my mind it wasn't enoug=
h;<br><br><br><span class=3D"span9">Thank you very much for your time,</spa=
n><br>i get that it wouldn't be as nice as it was supposed to be.<br><br>Ki=
ndest regards, Patryk.<br></div></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_2640_5502692.1419242261153--
------=_Part_2639_797049354.1419242261153--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 22 Dec 2014 19:44:59 -0200
Raw View
On Sunday 21 December 2014 18:37:40 Patryk W wrote:
> > least one more bit than the largest of the two numbers.
>
> Of course. But why not use bigger number for that kind of operations? It's
> not a shame to cut it later.

Because you *chose* to use the integer with "int" size. If you wanted bigger,
use bigger and pay the penalty. Some architectures can't do a 64-bit
multiplication and will have to implement it in software, which is much
slower.

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.