Topic: Re: [std-proposals] Re: Proposal to extend range-bas


Author: Zhihao Yuan <zy@miator.net>
Date: Wed, 5 Jul 2017 17:08:50 -0500
Raw View
--089e08236d64bffc490553993ee1
Content-Type: text/plain; charset="UTF-8"

On Wed, Jul 5, 2017 at 3:36 PM, Abdulla Herzallah <
abdulla.herzallah@gmail.com> wrote:

>
> The first two cases you presented does not match the idea as it require
> use of memory on the stack which is therefore not good idea.
>

Seems being falsified:

  https://godbolt.org/g/cJM4v3


> While the last example I am not sure I got you well on it, but it seems is
> what I am proposing in a different way, but none the less is still not
> possible without adding this feature to the language.
>

You seem to be not familiar with user-defined literal?

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

--
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/CAGsORuCTODS%3DkBYfw%2BTaBSag6TwxGtyts8LG9DwwF%2BhJzED%2Bew%40mail.gmail.com.

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

<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
On Wed, Jul 5, 2017 at 3:36 PM, Abdulla Herzallah <span dir=3D"ltr">&lt;<a =
href=3D"mailto:abdulla.herzallah@gmail.com" target=3D"_blank">abdulla.herza=
llah@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pad=
ding-left:1ex"><div></div><div><br></div><div>The first two cases you prese=
nted does not match the idea as it require use of memory on the stack which=
 is therefore not good idea.</div></blockquote><div><br></div><div>Seems be=
ing falsified:<br></div><div><br>=C2=A0 <a href=3D"https://godbolt.org/g/cJ=
M4v3">https://godbolt.org/g/cJM4v3</a><br>=C2=A0</div><blockquote class=3D"=
gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(20=
4,204,204);padding-left:1ex"><div>While the last example I am not sure I go=
t you well on it, but it seems is what I am proposing in a different way, b=
ut none the less is still not possible without adding this feature to the l=
anguage.<br></div><div></div></blockquote></div><br></div><div class=3D"gma=
il_extra">You seem to be not familiar with user-defined literal?<br clear=
=3D"all"></div><div class=3D"gmail_extra"><br>-- <br><div class=3D"gmail_si=
gnature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div>=
Zhihao Yuan, ID lichray<br>The best way to predict the future is to invent =
it.<br>_______________________________________________<br></div></div></div=
></div></div></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/CAGsORuCTODS%3DkBYfw%2BTaBSag6TwxGtyt=
s8LG9DwwF%2BhJzED%2Bew%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoo=
ter">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGsORuCT=
ODS%3DkBYfw%2BTaBSag6TwxGtyts8LG9DwwF%2BhJzED%2Bew%40mail.gmail.com</a>.<br=
 />

--089e08236d64bffc490553993ee1--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Thu, 06 Jul 2017 09:12:02 -0700
Raw View
On quinta-feira, 6 de julho de 2017 06:32:05 PDT Nicol Bolas wrote:
> On Wednesday, July 5, 2017 at 11:44:55 PM UTC-4, gmis...@gmail.com wrote:
> > Will the mythical standard library 2 I keep hearing about make std::size_t
> > a signed value?
>
> No. The most it might do is make `std*2*::size_t` a signed type. But that
> would be pointless since `sizeof` and `alignof` would still be returning
> `std::size_t`.

FYI, we've added "qssize_t" to Qt 5.10 and we are in the process of using it
throughout. We will very likely switch our containers to that in Qt 6.

Thanks go mostly to Marc Mutz.

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--
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/1871911.INlMbNTiZC%40tjmaciei-mobl1.

.


Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Fri, 7 Jul 2017 11:42:10 -0400
Raw View
On 2017-07-04 16:33, Nicol Bolas wrote:
> Speaking of literals, we can even have literals that do the entire job, so
> we don't need `std::ints` at all:
>
> for(auto i; 10rng)
> {
> }

Ah... I see now you are abbreviating "RaNGe". Yuck; please don't
abbreviate it like this. "RNG" also means "Random Number Generator",
which is very confusing.

Instead, I suggest perhaps "ri" / "ir" ("Integer Range" / "Range of
Integers"). This would also allow us to have e.g. "ri", "ru", "rl",
"rull", "rsz", etc. for various types besides just `int`.

--
Matthew

--
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/52b8b5ff-65de-2564-3dba-317b27eb63a9%40gmail.com.

.


Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Fri, 7 Jul 2017 11:54:13 -0400
Raw View
On 2017-07-07 07:37, Bengt Gustafsson wrote:
> However, I sometimes get into trouble when writing a loop where the=20
> loop variable is not needed in the loop body: I get compiler
> warnings about unused variables. While this can be considered a
> compiler bug it still has some value to be able to describe that the
> loop variable is not needed. Thus it would be possible to allow:
>=20
> for (:v.size())
>     whatever();
>=20
> but then again a special marker for "the unused varaible" would be more=
=20
> useful, such as:
>=20
> for (auto ? : v.size())
>     whatever();

As has been discussed before, it would be useful (for this and also
other contexts) to have a way to declare an anonymous variable; that is,
one that could be used as in your above example or also any time it is
necessary to construct an object and have it stick around for the usual
time (i.e. until end of scope), but where the variable is =E2=80=94 correct=
ly =E2=80=94
never referenced again after construction.

p.s. Yes, I believe loops where the iteration variable is not used can
legitimately happen:

  auto success =3D false;
  for (auto ? : max_retries)
  {
    if (try_something(...))
    {
      success =3D true;
      break;
    }
  }
  if (!success)
  {
    show_error();
  }

(Oh, look, a use case also for P3587...)

--=20
Matthew

--=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/196f2398-603f-45dc-d567-15de009cb598%40gmail.com=
..

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 7 Jul 2017 10:39:30 -0700 (PDT)
Raw View
------=_Part_4797_1854843308.1499449170581
Content-Type: multipart/alternative;
 boundary="----=_Part_4798_1226430591.1499449170581"

------=_Part_4798_1226430591.1499449170581
Content-Type: text/plain; charset="UTF-8"



On Friday, July 7, 2017 at 11:42:15 AM UTC-4, Matthew Woehlke wrote:
>
> On 2017-07-04 16:33, Nicol Bolas wrote:
> > Speaking of literals, we can even have literals that do the entire job,
> so
> > we don't need `std::ints` at all:
> >
> > for(auto i; 10rng)
> > {
> > }
>
> Ah... I see now you are abbreviating "RaNGe". Yuck; please don't
> abbreviate it like this. "RNG" also means "Random Number Generator",
> which is very confusing.
>
> Instead, I suggest perhaps "ri" / "ir" ("Integer Range" / "Range of
> Integers"). This would also allow us to have e.g. "ri", "ru", "rl",
> "rull", "rsz", etc. for various types besides just `int`.
>

Do you really need all of those, though? `int` and `size_t` really cover
most of the bases. `int`, being the default, and `size_t` being what lots
of standard library interfaces take by default (with signed/unsigned
mismatch warnings when incorrectly used).

You can always use the longer version `xrange<type>()` if you need
something out of the ordinary.

--
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/4d774ae2-3b46-498e-bd2a-b0604a4f589f%40isocpp.org.

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

<div dir=3D"ltr"><br><br>On Friday, July 7, 2017 at 11:42:15 AM UTC-4, Matt=
hew Woehlke wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 2017-07-0=
4 16:33, Nicol Bolas wrote:
<br>&gt; Speaking of literals, we can even have literals that do the entire=
 job, so=20
<br>&gt; we don&#39;t need `std::ints` at all:
<br>&gt;=20
<br>&gt; for(auto i; 10rng)
<br>&gt; {
<br>&gt; }
<br>
<br>Ah... I see now you are abbreviating &quot;RaNGe&quot;. Yuck; please do=
n&#39;t
<br>abbreviate it like this. &quot;RNG&quot; also means &quot;Random Number=
 Generator&quot;,
<br>which is very confusing.
<br>
<br>Instead, I suggest perhaps &quot;ri&quot; / &quot;ir&quot; (&quot;Integ=
er Range&quot; / &quot;Range of
<br>Integers&quot;). This would also allow us to have e.g. &quot;ri&quot;, =
&quot;ru&quot;, &quot;rl&quot;,
<br>&quot;rull&quot;, &quot;rsz&quot;, etc. for various types besides just =
`int`.<br></blockquote><div><br>Do you really need all of those, though? `i=
nt` and `size_t` really cover most of the bases. `int`, being the default, =
and `size_t` being what lots of standard library interfaces take by default=
 (with signed/unsigned mismatch warnings when incorrectly used).<br><br>You=
 can always use the longer version `xrange&lt;type&gt;()` if you need somet=
hing out of the ordinary.<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/4d774ae2-3b46-498e-bd2a-b0604a4f589f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/4d774ae2-3b46-498e-bd2a-b0604a4f589f=
%40isocpp.org</a>.<br />

------=_Part_4798_1226430591.1499449170581--

------=_Part_4797_1854843308.1499449170581--

.