220 35106 <5005582.pCRZNEiGFO@tjmaciei-mobl1> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Marking more std::string_view members noexcept
Date: Wed, 25 Oct 2017 19:16:55 -0700
Lines: 50
Approved: news@gmane.org
Message-ID: <5005582.pCRZNEiGFO@tjmaciei-mobl1>
References: <3d03cd7d-2177-98fd-408d-f74b1f6a8552@gmail.com> <CAGg_6+O6VhTD2vJoLVDONbbfw5EdSU5CW4D_KCdEvPT2V0DGrA@mail.gmail.com> <CAGg_6+O=N_3nogd-RbCGbAXAyX00UxETAgH6hZ5eJZoEyV001w@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1508984218 486 195.159.176.226 (26 Oct 2017 02:16:58 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 26 Oct 2017 02:16:58 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBGULYXHQKGQE7KRRRZY@isocpp.org Thu Oct 26 04:16:54 2017
Return-path: <std-proposals+bncBCB4TK757YBRBGULYXHQKGQE7KRRRZY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f69.google.com ([74.125.82.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCB4TK757YBRBGULYXHQKGQE7KRRRZY@isocpp.org>)
	id 1e7Xj2-0007rP-7X
	for gclcip-std-proposals@m.gmane.org; Thu, 26 Oct 2017 04:16:52 +0200
Original-Received: by mail-wm0-f69.google.com with SMTP id q124sf1115947wmb.23
        for <gclcip-std-proposals@m.gmane.org>; Wed, 25 Oct 2017 19:17:00 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1508984219; cv=pass;
        d=google.com; s=arc-20160816;
        b=qpnwaLjr9WqyV/jb3/bjNWTtD4o8lYpk71x/4hjfpmw1JPQ8U3ZhVfD+0O+A6d/JBc
         xpTWlGJS/a4p0EGdN+3J4JDx3O4YwVfE7PwDCR1jE1D4GkNLrf9lllw3dd0ophpf23Bd
         t29TJG6wsefJW+oRZ+LDe0oaunjP0+KIcvCzlLBRDJnsnpMi7Qf5bIU1Jtz/qVf6fI39
         XEwDBgR8s3tNIBwxw5iK3dTpTS+RJzHhaxfIdCgGPy2+0kuvDS2zcr5fWH3rBbSjGDuh
         A7LRDqkDdm4YCe9ciJUmRvQQ3Gt6ZYeCdTekgtjZDPjAuydHA0bOP3bHo2cn2T+LnvBV
         gXoQ==
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:mime-version:references
         :in-reply-to:message-id:date:subject:to:from
         :arc-authentication-results:arc-message-signature:dkim-signature
         :arc-authentication-results;
        bh=HmKPorx0xEH+ziisb/awGIaGExWiFuEcsJePs3tkVw8=;
        b=XhPCD1VuhA9b6mgI040lW/z/TVe8VelPjb+MpTAI3c4Q0l/zV5vtfF5tMQf4IgeLr0
         XSF+u183I7UXjA0P1goscOpJrq8XIvLuAtzGFH4Q4hPdYFoxCJoE7hc+bI8WiMzSDUa/
         6hvdg8etuTlM1YZdaaAUVdD6TT7TaWvIE2bHOJFUchL2TiBnulxOtaDtlSkgZ4OKLWVF
         UNxdXvwyXktEExb7kDBDL1WAelTpuCxQ6Pqh24FCnutqToHx5Ro41b0mNTuAALarqtC3
         9kA86KTBRgzNRw3SpALl3zRmXOGfUZ4W3MfXICX9nI7mRut6evuAjqvFydEsAg2gCama
         OhUw==
ARC-Authentication-Results: i=2; mx.google.com;
       spf=pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mailfrom=thiago@macieira.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=HmKPorx0xEH+ziisb/awGIaGExWiFuEcsJePs3tkVw8=;
        b=c6CCGp6gsy5PLe/HcOXXCnUFdf4T8QLlxQBL/mWHCUQJXsPCUdL9UV+eu/H+v/fhWp
         qmob+nczlooe+2Ls6+DTlsSnddoYybSJpmZgCCoLTM/SoXRet/O5jNjEWiu9qhznpkQX
         OOzco658jthCLnIBAs2/Uir+IfzgbHbTe8uG3J6ZuQELWmD/V5y3H86CdcwZD3aVqfIt
         m14pZs+KWfUPg1aVbSNavj0yn4evt6nJus+wQ3ibxj9/uAwt43XZsKh03DMgUbSEePOj
         DlB0bQSYmA/z73jbRptq8t/fSYB+tWmSNNMGd1q499SxyCOytWPCcYNooeFsFMA4iHyD
         yRTA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version: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=HmKPorx0xEH+ziisb/awGIaGExWiFuEcsJePs3tkVw8=;
        b=UL1s4ndTqWrtXKj3E8Xp0HPUogfvOmGZeY6dD0ODE+k1yfiey1y9KZFIxB28F9eXpO
         htERmDf/UTgWMVY6sWJKW6e2BVM928twEZN3upcpLIg+mvrid5r9jMn5FWUrpmExYjsl
         U5TJlHUpDbernIGDZBo6ODMcdXO8ROMpdpnDyXaj2eThZKUsZpUGo73qgFWvLD6MbxUy
         uKhqZqH7UWtxQ8G/BAmnDepiW4EFisR5KuFy308mxGj96vcOQZF/L6RYsZrmkUKuYbti
         P3r4gTWl8cXrPv2URBunWqgylElx5UuLDamy2jcHe7Gyf96qy8pmdkDb4wsmcrYuTfRK
         ghLA==
X-Gm-Message-State: AMCzsaVWjT97tHdZoJNgQoCcbfrgPjEzMVU07ow0LM2M8raLEeaMVhHp
	BZitekv3Lch5QwC6n9lafKZVyg==
X-Google-Smtp-Source: ABhQp+SPlOaAt9J2Vm1mKpvqZuyZbg+0LufZH1Iq4MONdLgVFo9O+vkp7O8pLdi0qGvz71xcE8JTuQ==
X-Received: by 10.223.163.215 with SMTP id m23mr382178wrb.25.1508984219745;
        Wed, 25 Oct 2017 19:16:59 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.112.26 with SMTP id l26ls1118195wmc.4.canary-gmail; Wed, 25
 Oct 2017 19:16:58 -0700 (PDT)
X-Received: by 10.28.232.88 with SMTP id f85mr169120wmh.62.1508984218539;
        Wed, 25 Oct 2017 19:16:58 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1508984218; cv=none;
        d=google.com; s=arc-20160816;
        b=iIFmC5diZsI5w2riMqIVXdNbhDG3Hvoj7VLPOcKKXXVybNIBzIeZzZ/8TZYs7gI3q4
         jwXExF21NS3tvefow5dpPUXhrMLcNKdB/HvCPx2iWhyZ8LKm1ylWzCfZzIglJN0hQ507
         /9oICBXD08gzSm7QbfZ9yPv/tL4sY3FuTCsL9xeZE64EtrkluHTeIbcxyfZ/kP0Nafrs
         NTTZ9nylQl1c802xJu0GyXovxbpldtxImrXoVwmeJrCfWFBbm+Fmnad0CqjI4wTO2OFu
         TzK/OgawhXrox1xqIL6qg8DSXXfiQeFT8IOS8A7KGqwuZgiAxNFJVCGMwp2oiRas/RnU
         OiRw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:to:from:arc-authentication-results;
        bh=ijDuPiTVUv/+0Dnpxz2U2yCJpCYhNlixFk2K8QqVWcA=;
        b=jg0IUQTKnpljEQmfrs5C+f22KZAV1kthAPjj4DIsoFGfsKBs1urle3CbzDNba+Hizl
         1KGJpFpIbOAIKDw22qQUq28HCZBh/ybn5Vc3U7km55dy1MEFFRHBjkITgeR6yOxacdwp
         VLKYH3arM4IP+VEzbCUxkY8qj2PzbEBQTImdT3r7YSfVyZjq1jnXPDngSulICkM1q6oz
         i9M6Ahc3p7XI0tXlNg9pCVFHWUgd/fV8+u9+OC5BRiyf6bD3/0Q3gXQao7cgP9XsGj2D
         SipsgLzwZrt/4cpSjFGIjhzCbbFpwkuqHUedaYpOGmvKnYEB1NCn1r60a01sem3LTZGZ
         WpaQ==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mailfrom=thiago@macieira.org
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [78.47.120.188])
        by mx.google.com with ESMTP id t9si173237wmt.36.2017.10.25.19.16.58
        for <std-proposals@isocpp.org>;
        Wed, 25 Oct 2017 19:16:58 -0700 (PDT)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) client-ip=78.47.120.188;
Original-Received: from tjmaciei-mobl1.localnet (unknown [IPv6:2601:1c0:4501:5f9f:d45e:bf18:2219:b394])
	by gondolin.macieira.info (Postfix) with ESMTPSA id EB70111B5A6
	for <std-proposals@isocpp.org>; Wed, 25 Oct 2017 19:16:57 -0700 (PDT)
In-Reply-To: <CAGg_6+O=N_3nogd-RbCGbAXAyX00UxETAgH6hZ5eJZoEyV001w@mail.gmail.com>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mailfrom=thiago@macieira.org
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:35106
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/35106>

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

We've also had a long-time issue with embedded nuls in arrays in other 
contexts. For example:

	const char data[] = "Hello World";
	QByteArray ba(data);
	ba[5] = '\0';
	return QString::fromLatin1(ba);

Previously, QString::fromLatin1 did not have an overload for QByteArray, so it 
was automatically cast to const char* and strlen applied. So this code 
returned "Hello".

At some point, we added the overload, but it broke a lot of code that depended 
on the null stopping the conversion. And it wasn't just a handful of cases, 
plus they were quite difficult to track down.

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.

-- 
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/5005582.pCRZNEiGFO%40tjmaciei-mobl1.

.
