220 35107 <CAGg_6+M1gvNh82YX6x4Nr3=rFSPW973nmumTF0SkyMJ7c2Yoew@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nevin Liber <nevin@eviloverlord.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Marking more std::string_view members noexcept
Date: Wed, 25 Oct 2017 21:30:21 -0500
Lines: 139
Approved: news@gmane.org
Message-ID: <CAGg_6+M1gvNh82YX6x4Nr3=rFSPW973nmumTF0SkyMJ7c2Yoew@mail.gmail.com>
References: <3d03cd7d-2177-98fd-408d-f74b1f6a8552@gmail.com>
 <CAGg_6+O6VhTD2vJoLVDONbbfw5EdSU5CW4D_KCdEvPT2V0DGrA@mail.gmail.com>
 <CAGg_6+O=N_3nogd-RbCGbAXAyX00UxETAgH6hZ5eJZoEyV001w@mail.gmail.com> <5005582.pCRZNEiGFO@tjmaciei-mobl1>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="001a114b6d0699a48d055c69f69a"
X-Trace: blaine.gmane.org 1508985070 31728 195.159.176.226 (26 Oct 2017 02:31:10 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 26 Oct 2017 02:31:10 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCE35H5S6IDBBZ4RYXHQKGQETAV22MQ@isocpp.org Thu Oct 26 04:31:03 2017
Return-path: <std-proposals+bncBCE35H5S6IDBBZ4RYXHQKGQETAV22MQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f70.google.com ([209.85.213.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCE35H5S6IDBBZ4RYXHQKGQETAV22MQ@isocpp.org>)
	id 1e7Xwf-0006wL-KN
	for gclcip-std-proposals@m.gmane.org; Thu, 26 Oct 2017 04:30:57 +0200
Original-Received: by mail-vk0-f70.google.com with SMTP id w186sf1042062vkf.10
        for <gclcip-std-proposals@m.gmane.org>; Wed, 25 Oct 2017 19:31:05 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1508985064; cv=pass;
        d=google.com; s=arc-20160816;
        b=xXwfc1DGj9hbBgZS+6np0fpyrCJhD8pw8kJEmR81HUDETySIYGDFwTgZwYdJgkLjrV
         pgML75odsZSmdBu+LT537KO49zdpkAW9tShgeDYwE+eTpvkAzUWfHfWRuEiUnzgSoFFr
         Ft9rQkMy4gkS/ezcPUGa8Shm+FedQ4LozEw2w6szH2c8XkVwoTxhcJDecjcfUBscuoHn
         UKgyZV5ej+oViaCKZ17g5sVBFZemJ35mkJP2QuLrDYexTdf0fv2FJc96XkDunTvvjTe2
         0hty0Lah8s7hVrxRWYBhkdx/p8YPQ7Cv7Ll0riXOof0ikcMwJiWqV8teDUOV+3h2i84a
         7nmw==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:in-reply-to:sender:mime-version
         :arc-authentication-results:arc-message-signature
         :arc-authentication-results;
        bh=/u6hn30Ef/a8QOhyLbTPLnaOf7oi/zD0XIcLtz9MOmM=;
        b=0FumcK/lFJ/fR80/6U0cxOV80O5maMfiOoqNE0vU5yqEY5YFD8OUzQntTE8jkkLlIj
         6/6hGgm1ey7jz2QV2c5Rt0JjlfCAum0Fg8PKU2q6hd54P5pVdZOuhK1fuYOAbefF8gxR
         o3x+Jqxdes4vJtQ/gm7ElfFtrOpDLA2wD53zTwxy5oxH4RTUSaWUn6AcIppKuMry04ht
         zfFJVj5XUso2lXkk0qsVtnyDy4ddXmGJcbAp35OcbQU/Y+WxDmVAH5uhWMl7GkvSqhbM
         I5qhd5oTWEEMuZZrctG4bs5/lq+qCiGZ0pZTHOodrJ8YWqdQYgCPPy0ziC4RnWrJgz8t
         vGDQ==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=PRQVcFbr;
       spf=pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=nliber@gmail.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=/u6hn30Ef/a8QOhyLbTPLnaOf7oi/zD0XIcLtz9MOmM=;
        b=QbpcI426Fw2hwb9BKeESrpa7LRmfK2XFMXi+UfNYzdEIzgM0C2CYAvXLKj63ePqv+X
         lEJLWXTgiYnlg0NiSofTX7FrXzfJF/QxXKquGn7fBRlNDLL7+Zk38Wa6Vd6Wggpf5JGd
         te+cMVuyBWqhnlde+8glKJY6S0UDvsG+Au9uWraQMfQCtKJAx4G5LZ4O9lwYBSCxkI/e
         G8Fwd87MtB2g/7r5rHFFkGjilXxUB5d729EaN95UTd8BD3XcbJPtWxWBb4fq7liRVLLk
         DAphUFp6OBTIF2aInwJohuuIfZoFPwhY06YcHDwDmH8+qhaBLJ2KYL/KgT86Hh80au7e
         gcYw==
X-Gm-Message-State: AMCzsaUQ/E3len9VBqH8AI321Tr+i/VZjZ0c9zb+tawHI4DAbryZivfa
	uoUcd8vupUSVIajOHXB4sN0=
X-Google-Smtp-Source: ABhQp+TU9txRp7Ro6pmARvUnlQ0DtsbMskQXFIh43a9/nyF+NbxC0DL/yUvdQUyrQ5gyAsQhvpMlVA==
X-Received: by 10.31.10.67 with SMTP id 64mr2009762vkk.17.1508985064588;
        Wed, 25 Oct 2017 19:31:04 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.139.134 with SMTP id n128ls1154333vkd.7.gmail; Wed, 25 Oct
 2017 19:31:02 -0700 (PDT)
X-Received: by 10.31.32.65 with SMTP id g62mr2896317vkg.160.1508985062766;
        Wed, 25 Oct 2017 19:31:02 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1508985062; cv=none;
        d=google.com; s=arc-20160816;
        b=lLSfE7AO2zquQyy640vDdexuHLDG+ktQ1Zbsi7MXVEAeHKQ5/tawwIP2nJicfN8wg4
         1d0PH8iccYZSwwzWYlur+EMXLrNRwDEqDb1xVyDqCDnoCb7jAYaKF+aZJxEOh2OSy5I6
         0p8vtBN6PF0x4j+UntQyPZx8YT6IQriQNIpekCp0gcN6KALmaTDn9pm+XS51AZeg0Boy
         dfL1lVY+U6ZEn1FGPw5eeql31vD75WWBnxf9ASZ1auQwxAj1cnagwrbAVy/O6rmVeErW
         wcV9rziO4bm5Gfvhi8nTG8B1P/P8mNDNlcTWaXn7XAYBS9qj/scdpWcDR1u94oTO7AP3
         4SmQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:sender
         :mime-version:dkim-signature:arc-authentication-results;
        bh=BYtiKPbIoTxhnsSVUnhy/MbyUh96btYfrgQ3Wa+4KnQ=;
        b=BX+A5ZJ03Rh8S3CHaf3I/1Q81AprTGoQG0SIcdWcuXh+CpcOAJnUkeWR30AgFDV9Rf
         KT9xg5j7pPWPRHCbb7OBrRPOebBPz5NCn4Eb2GCVhGCsh5N+TA6Hj5o/7w19kyo5Pzll
         YCUhqiikFXv5IP/eKkun2GlG09Q5ySVWC3e+mYyoE7XuNtAnCvTCnvqtey+nqdzen++C
         AhhBp2KrkgAo5iydARmZ2eUPUdVo/IYeZk/ynhdCXHCPoxa99K+XapqlvcXdjaIR5xAT
         8T8UEyBWT+Ge2V5U+vEob4t6wn13XZQz/hEQ5qcdJCyXh+qYenfZ9GQi2UOkPjOxXiPz
         7SIg==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=PRQVcFbr;
       spf=pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=nliber@gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id p42sor1743456uad.108.2017.10.25.19.31.02
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Wed, 25 Oct 2017 19:31:02 -0700 (PDT)
Received-SPF: pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.159.41.65 with SMTP id t59mr2852628uat.99.1508985062137;
 Wed, 25 Oct 2017 19:31:02 -0700 (PDT)
Original-Sender: nliber@gmail.com
Original-Received: by 10.103.71.140 with HTTP; Wed, 25 Oct 2017 19:30:21 -0700 (PDT)
In-Reply-To: <5005582.pCRZNEiGFO@tjmaciei-mobl1>
X-Original-Sender: nevin@eviloverlord.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=PRQVcFbr;       spf=pass
 (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted
 sender) smtp.mailfrom=nliber@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:35107
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/35107>

--001a114b6d0699a48d055c69f69a
Content-Type: text/plain; charset="UTF-8"

On Wed, Oct 25, 2017 at 9:16 PM, Thiago Macieira <thiago@macieira.org>
wrote:

> On Wednesday, 25 October 2017 18:51:43 PDT Nevin Liber wrote:
> > Technically, it doesn't have to be a breaking change, as long as all it
> >
> > does is define behavior for:
> > > const char s[] = { 'H', 'e', 'l', 'l', 'o' };
> > > string_view b(s);
> > >
> > > Right now:
> > >
> > > b.size() // UB
> >
> > I don't see that as particularly useful.
>
> QStringView has both a pointer and an array constructor. That means:
>
>         const char16_t str[] = u"Hello\0World";
>
>         QStringView(str).size() == 11   // constexpr
>         QStringView(+str).size() == 5   // not constexpr
>

I'm not sure what constexpr has to do with it.  Isn't it array vs. pointer
that matters?

It also means

QStringView(b ? u"Hello\0World" : u"Howdy\0World") has subtly different
behavior than QStringView(b ? u"Hello\0World" : u"Goodbye\0World"), doesn't
it?


> If we had added the constructor at the moment the class was introduced,
> there
> would have been no legacy to deal with. Now there will be, so it needs to
> be
> done with great care.
>

Again, I think matching an array is the wrong solution to the question of
"is this a string literal"?

A better solution might be a magic type that, in template contexts, matches
better than an array but easily decays to an array.  OTOH, it might not be
(I haven't really thought about it much).  And it still wouldn't address
the ternary operator problem I mentioned above.
-- 
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  +1-847-691-1404
<(847)%20691-1404>

-- 
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/CAGg_6%2BM1gvNh82YX6x4Nr3%3DrFSPW973nmumTF0SkyMJ7c2Yoew%40mail.gmail.com.

--001a114b6d0699a48d055c69f69a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wed, Oct 25, 2017 at 9:16 PM, Thiago Macieira <span dir=
=3D"ltr">&lt;<a href=3D"mailto:thiago@macieira.org" target=3D"_blank">thiag=
o@macieira.org</a>&gt;</span> wrote:<br><div class=3D"gmail_extra"><div cla=
ss=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 =
..8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Wednesday, 25 Oc=
tober 2017 18:51:43 PDT Nevin Liber wrote:<br>
&gt; Technically, it doesn&#39;t have to be a breaking change, as long as a=
ll it<br>
&gt;<br>
&gt; does is define behavior for:<br>
&gt; &gt; const char s[] =3D { &#39;H&#39;, &#39;e&#39;, &#39;l&#39;, &#39;=
l&#39;, &#39;o&#39; };<br>
&gt; &gt; string_view b(s);<br>
&gt; &gt;<br>
&gt; &gt; Right now:<br>
&gt; &gt;<br>
&gt; &gt; b.size() // UB<br>
&gt;<br>
&gt; I don&#39;t see that as particularly useful.<br>
<br>
</span>QStringView has both a pointer and an array constructor. That means:=
<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 const char16_t str[] =3D u&quot;Hello\0World&qu=
ot;;<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 QStringView(str).size() =3D=3D 11=C2=A0 =C2=A0/=
/ constexpr<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 QStringView(+str).size() =3D=3D 5=C2=A0 =C2=A0/=
/ not constexpr<br></blockquote><div><br></div><div>I&#39;m not sure what c=
onstexpr has to do with it.=C2=A0 Isn&#39;t it array vs. pointer that matte=
rs?</div><div><br></div><div>It also means</div><div><br></div><div>QString=
View(b ? u&quot;Hello\0World&quot; : u&quot;Howdy\0World&quot;) has subtly =
different behavior than QStringView(b ? u&quot;Hello\0World&quot; : u&quot;=
Goodbye\0World&quot;), doesn&#39;t it?</div><div>=C2=A0</div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;p=
adding-left:1ex">
If we had added the constructor at the moment the class was introduced, the=
re<br>
would have been no legacy to deal with. Now there will be, so it needs to b=
e<br>
done with great care.<br></blockquote><div><br></div><div>Again, I think ma=
tching an array is the wrong solution to the question of &quot;is this a st=
ring literal&quot;?</div><div><br></div><div>A better solution might be a m=
agic type that, in template contexts, matches better than an array but easi=
ly decays to an array.=C2=A0 OTOH, it might not be (I haven&#39;t really th=
ought about it much).=C2=A0 And it still wouldn&#39;t address the ternary o=
perator problem I mentioned above.</div></div>-- <br><div class=3D"m_-19439=
6159271978786m_-3005333622292479268gmail_signature" data-smartmail=3D"gmail=
_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div>=C2=A0Nevin &quot;:=
-)&quot; Liber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.com" t=
arget=3D"_blank">nevin@eviloverlord.com</a><wbr>&gt; =C2=A0<a href=3D"tel:(=
847)%20691-1404" value=3D"+18476911404" target=3D"_blank">+1-847-691-1404</=
a></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/CAGg_6%2BM1gvNh82YX6x4Nr3%3DrFSPW973n=
mumTF0SkyMJ7c2Yoew%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGg_6%2BM1gv=
Nh82YX6x4Nr3%3DrFSPW973nmumTF0SkyMJ7c2Yoew%40mail.gmail.com</a>.<br />

--001a114b6d0699a48d055c69f69a--

.
