Topic: Const-correct strtol, etc.


Author: eric41293@comcast.net
Date: Fri, 22 Jan 2016 08:50:31 -0800 (PST)
Raw View
------=_Part_184_1073476943.1453481431009
Content-Type: multipart/alternative;
 boundary="----=_Part_185_116145841.1453481431009"

------=_Part_185_116145841.1453481431009
Content-Type: text/plain; charset=UTF-8

Certain functions from the C standard library have in C++ two overloads
differing only in their const qualifiers. For example, the strchr function:

const char * strchr(const char *, int);
char * strchr(char *, int);

This is because the return value may point to a character in the string
pointed to by the first argument.

However, such overloads do not exist for strtol, strtod, etc. There is for
strtol only the single signature from C:

long strtol(const char *, char **, int);

Yet this function has the same problem as C's strchr. The second parameter
is an output parameter and the char* pointed to may be set to point to a
character in the first argument string, thus violating const safety. Unless
there is some reason (of which I am unaware) that it would be a problem, I
would like to propose replacing the signatures for strtol and friends with
their appropriate const-correct overloads. For example:

long strtol(const char *, const char **, int);
long strtol(char *, char **, int);

--

---
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 https://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<div dir=3D"ltr">Certain functions from the C standard library have in C++ =
two overloads differing only in their const qualifiers. For example, the st=
rchr function:<br><br>const char * strchr(const char *, int);<br>char * str=
chr(char *, int);<br><br>This is because the return value may point to a ch=
aracter in the string pointed to by the first argument.<br><br>However, suc=
h overloads do not exist for strtol, strtod, etc. There is for strtol only =
the single signature from C:<br><br>long strtol(const char *, char **, int)=
;<br><br>Yet this function has the same problem as C&#39;s strchr. The seco=
nd parameter is an output parameter and the char* pointed to may be set to =
point to a character in the first argument string, thus violating const saf=
ety. Unless there is some reason (of which I am unaware) that it would be a=
 problem, I would like to propose replacing the signatures for strtol and f=
riends with their appropriate const-correct overloads. For example:<br><br>=
long strtol(const char *, const char **, int);<br>long strtol(char *, char =
**, int);<br></div>

<p></p>

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

------=_Part_185_116145841.1453481431009--
------=_Part_184_1073476943.1453481431009--

.


Author: Myriachan <myriachan@gmail.com>
Date: Fri, 22 Jan 2016 11:53:13 -0800 (PST)
Raw View
------=_Part_3212_1938274534.1453492393637
Content-Type: multipart/alternative;
 boundary="----=_Part_3213_1855578063.1453492393638"

------=_Part_3213_1855578063.1453492393638
Content-Type: text/plain; charset=UTF-8

On Friday, January 22, 2016 at 8:50:31 AM UTC-8, eric...@comcast.net wrote:
>
> I would like to propose replacing the signatures for strtol and friends
> with their appropriate const-correct overloads. For example:
>
> long strtol(const char *, const char **, int);
> long strtol(char *, char **, int);
>

Unfortunately, I don't think that this is possible without craziness, due
to overload ambiguity.

All existing code that calls std::strtol today with a const string and
makes use of the endptr parameter already has to pass a non-const endptr,
so you also would need this overload to remain, in order to keep existing
code working.  Now you have three overloads:

long strtol(const char *, const char **, int);
long strtol(char *, char **, int);
long strtol(const char *, char **, int);  // legacy

Now you have to handle code that passes a const string and nullptr as endptr,
as in:

void meow(const char *str)
{
    std::printf("%ld\n", strtol(str, nullptr, 0));
}

But this is ambiguous, because two of the overloads match it:

long strtol(const char *, const char **, int);
long strtol(const char *, char **, int);

You could resolve it by adding a new overload:

long strtol(const char *, nullptr_t, int);

But now, the problem becomes existing code that uses NULL or 0 instead of
nullptr.  The std::nullptr_t overload doesn't help with that.  But you
could add this overload:

long strtol(const char *, int, int);

And now I feel that this has gone off the deep end.

Melissa


--

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

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

<div dir=3D"ltr">On Friday, January 22, 2016 at 8:50:31 AM UTC-8, eric...@c=
omcast.net wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr">I would like to propose replacing the signatures for <span style=3D"fon=
t-family: courier new,monospace;">strtol</span> and friends with their appr=
opriate const-correct overloads. For example:<br><br><span style=3D"font-fa=
mily: courier new,monospace;">long strtol(const char *, const char **, int)=
;<br>long strtol(char *, char **, int);</span><br></div></blockquote><div><=
br>Unfortunately, I don&#39;t think that this is possible without craziness=
, due to overload ambiguity.<br><br>All
 existing code that calls <span style=3D"font-family: courier new,monospace=
;">std::strtol</span> today with a const string and=20
makes use of the <span style=3D"font-family: courier new,monospace;">endptr=
</span> parameter already has to pass a non-const <span style=3D"font-famil=
y: courier new,monospace;">
endptr</span>, so you also would need this overload to remain, in order to =
keep
 existing code working.=C2=A0 Now you have three overloads:<br><br><div cla=
ss=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-co=
lor: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap:=
 break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">long</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> strtol</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">const</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">char</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">*,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">const</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">char</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">**,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">long</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> st=
rtol</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">char</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">*,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">char</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">**,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">i=
nt</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">long</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> strtol</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">const</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">char</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">*,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">char</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">**,</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">int</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> =C2=A0</span><span style=3D"color: #800;" class=3D"style=
d-by-prettify">// legacy</span></div></code></div><br>Now you have to handl=
e code that passes a const string and <span style=3D"font-family: courier n=
ew,monospace;">nullptr</span> as <span style=3D"font-family: courier new,mo=
nospace;">endptr</span>, as in:<br><br><div class=3D"prettyprint" style=3D"=
background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); bor=
der-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D=
"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> meow</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">const</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">char</s=
pan><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">str</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0 =C2=A0 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">printf</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">(</span><span style=3D"color: #080;" class=3D"styled-by-prett=
ify">&quot;%ld\n&quot;</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> strtol</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">str</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">nullptr</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"=
styled-by-prettify">0</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">));</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}<=
/span></div></code></div><br>But this is ambiguous, because two of the over=
loads match it:<br><br><div class=3D"prettyprint" style=3D"background-color=
: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid=
; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><d=
iv class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by=
-prettify">long</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> strtol</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">const</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">char</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #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">const</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">char</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">**,</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">long</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> strtol</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">const</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>char</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><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: #008;" class=3D"styled-by-prettify">char</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">**,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">int</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br></span></div></code></div><br>You could resolve it by adding a new over=
load:<br><br><div class=3D"prettyprint" style=3D"background-color: rgb(250,=
 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-w=
idth: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">long</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> st=
rtol</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">const</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">char</span><span style=3D"co=
lor: #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"> nullptr_t</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)=
;</span></div></code></div><br>But
 now, the problem becomes existing code that uses <span style=3D"font-famil=
y: courier new,monospace;">NULL</span> or <span style=3D"font-family: couri=
er new,monospace;">0</span> instead of <span style=3D"font-family: courier =
new,monospace;">
nullptr</span>.=C2=A0 The <span style=3D"font-family: courier new,monospace=
;">std::nullptr_t</span> overload doesn&#39;t help with that.=C2=A0 But you=
=20
could add this overload:<br><br><div class=3D"prettyprint" style=3D"backgro=
und-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-sty=
le: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"pretty=
print"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"=
styled-by-prettify">long</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> strtol</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">const</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">char</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=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">int</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n></div></code></div><br>And now I feel that this has gone off the deep end=
..<br><br>Melissa<br>=C2=A0</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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />

------=_Part_3213_1855578063.1453492393638--
------=_Part_3212_1938274534.1453492393637--

.


Author: eric41293@comcast.net
Date: Fri, 22 Jan 2016 13:05:22 -0800 (PST)
Raw View
------=_Part_1131_1554795560.1453496722837
Content-Type: multipart/alternative;
 boundary="----=_Part_1132_1692181417.1453496722843"

------=_Part_1132_1692181417.1453496722843
Content-Type: text/plain; charset=UTF-8

On Friday, January 22, 2016 at 12:53:13 PM UTC-7, Myriachan wrote:
>
> On Friday, January 22, 2016 at 8:50:31 AM UTC-8, eric...@comcast.net
> wrote:
>>
>> I would like to propose replacing the signatures for strtol and friends
>> with their appropriate const-correct overloads. For example:
>>
>> long strtol(const char *, const char **, int);
>> long strtol(char *, char **, int);
>>
>
> Unfortunately, I don't think that this is possible without craziness, due
> to overload ambiguity.
>
> All existing code that calls std::strtol today with a const string and
> makes use of the endptr parameter already has to pass a non-const endptr,
> so you also would need this overload to remain, in order to keep existing
> code working.
>

Yes, you are right. This is unfortunate. I do note that the entire mess of
overloads is a consequence of retaining the legacy overload. Whether the
resulting code breakage from removing the legacy overload is acceptable I
don't know, but I expect not.

--

---
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 https://groups.google.com/a/isocpp.org/group/std-proposals/.

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

On Friday, January 22, 2016 at 12:53:13 PM UTC-7, Myriachan wrote:<blockquo=
te class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left:=
 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">On Friday, January 22,=
 2016 at 8:50:31 AM UTC-8, <a>eric...@comcast.net</a> wrote:<blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc=
 solid;padding-left:1ex"><div dir=3D"ltr">I would like to propose replacing=
 the signatures for <span style=3D"font-family:courier new,monospace">strto=
l</span> and friends with their appropriate const-correct overloads. For ex=
ample:<br><br><span style=3D"font-family:courier new,monospace">long strtol=
(const char *, const char **, int);<br>long strtol(char *, char **, int);</=
span><br></div></blockquote><div><br>Unfortunately, I don&#39;t think that =
this is possible without craziness, due to overload ambiguity.<br><br>All
 existing code that calls <span style=3D"font-family:courier new,monospace"=
>std::strtol</span> today with a const string and=20
makes use of the <span style=3D"font-family:courier new,monospace">endptr</=
span> parameter already has to pass a non-const <span style=3D"font-family:=
courier new,monospace">
endptr</span>, so you also would need this overload to remain, in order to =
keep
 existing code working.<br></div></div></blockquote><div>=C2=A0<br>Yes, you=
 are right. This is unfortunate. I do note that the entire mess of overload=
s is a consequence of retaining the legacy overload. Whether the resulting =
code breakage from removing the legacy overload is acceptable I don&#39;t k=
now, but I expect not.<br></div>

<p></p>

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

------=_Part_1132_1692181417.1453496722843--
------=_Part_1131_1554795560.1453496722837--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 22 Jan 2016 16:05:18 -0800
Raw View
On Friday 22 January 2016 11:53:13 Myriachan wrote:
> And now I feel that this has gone off the deep end.

In other words, let's have the C++ version of string-to-number parsing that
was discussed some time ago.
--
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 https://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Date: Sat, 23 Jan 2016 00:55:55 -0800 (PST)
Raw View
------=_Part_17_666340766.1453539355100
Content-Type: multipart/alternative;
 boundary="----=_Part_18_647581234.1453539355104"

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

Yes. We need functions based on string_view so that we can limit how far=20
the function reads without copying the characters or temporarily place a=20
null character in the string.

I would also hope that this was done in a template friendly way, i.e. using=
=20
one overloaded name, such as from_string.

we also need a way to control which decimal char(s) are accepted at the=20
call site.

I think all this was covered in the previous discussion which if I remember=
=20
correctly was destroyed by nitpicking about whether it should ignore=20
leading whitespace or not.



Den l=C3=B6rdag 23 januari 2016 kl. 01:05:26 UTC+1 skrev Thiago Macieira:
>
> On Friday 22 January 2016 11:53:13 Myriachan wrote:=20
> > And now I feel that this has gone off the deep end.=20
>
> In other words, let's have the C++ version of string-to-number parsing=20
> that=20
> was discussed some time ago.=20
> --=20
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org=20
>    Software Architect - Intel Open Source Technology Center=20
>       PGP/GPG: 0x6EF45358; fingerprint:=20
>       E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358=20
>
>

--=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.

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

<div dir=3D"ltr">Yes. We need functions based on string_view so that we can=
 limit how far the function reads without copying the characters or tempora=
rily place a null character in the string.<div><br></div><div>I would also =
hope that this was done in a template friendly way, i.e. using one overload=
ed name, such as from_string.</div><div><br></div><div>we also need a way t=
o control which decimal char(s) are accepted at the call site.</div><div><b=
r></div><div>I think all this was covered in the previous discussion which =
if I remember correctly was destroyed by nitpicking about whether it should=
 ignore leading whitespace or not.</div><div><br></div><div><br><br>Den l=
=C3=B6rdag 23 januari 2016 kl. 01:05:26 UTC+1 skrev Thiago Macieira:<blockq=
uote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-lef=
t: 1px #ccc solid;padding-left: 1ex;">On Friday 22 January 2016 11:53:13 My=
riachan wrote:
<br>&gt; And now I feel that this has gone off the deep end.
<br>
<br>In other words, let&#39;s have the C++ version of string-to-number pars=
ing that=20
<br>was discussed some time ago.
<br>--=20
<br>Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" target=
=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.goo=
gle.com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQ=
jCNEswDUBNCNanbu7euhqLn_62FW8ag&#39;;return true;" onclick=3D"this.href=3D&=
#39;http://www.google.com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46snt=
z\0751\46usg\75AFQjCNEswDUBNCNanbu7euhqLn_62FW8ag&#39;;return true;">maciei=
ra.info</a> - thiago (AT) <a href=3D"http://kde.org" target=3D"_blank" rel=
=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\7=
5http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo5_JYG1Dowztw=
AHAKs80XSA&#39;;return true;" onclick=3D"this.href=3D&#39;http://www.google=
..com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo=
5_JYG1DowztwAHAKs80XSA&#39;;return true;">kde.org</a>
<br>=C2=A0 =C2=A0Software Architect - Intel Open Source Technology Center
<br>=C2=A0 =C2=A0 =C2=A0 PGP/GPG: 0x6EF45358; fingerprint:
<br>=C2=A0 =C2=A0 =C2=A0 E067 918B B660 DBD1 105C =C2=A0966C 33F5 F005 6EF4=
 5358
<br>
<br></blockquote></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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />

------=_Part_18_647581234.1453539355104--
------=_Part_17_666340766.1453539355100--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Sat, 23 Jan 2016 01:25:11 -0800
Raw View
On Saturday 23 January 2016 00:55:55 Bengt Gustafsson wrote:
> we also need a way to control which decimal char(s) are accepted at the
> call site.

For integers, none.

For floating-point, it's not going to be a template with iterators and such, so
we should integrate with the locale API. You'll get the decimal from there.
--
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 https://groups.google.com/a/isocpp.org/group/std-proposals/.

.