220 12380 <CAGg_6+PeL39jmg1ENnN0=Dms4GjpAA4JR4N9SJiEjs73dNgfEg@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Nevin Liber <nevin@eviloverlord.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Local variables that overstay their welcome
Date: Wed, 20 Aug 2014 10:19:36 -0500
Lines: 78
Approved: news@gmane.org
Message-ID: <CAGg_6+PeL39jmg1ENnN0=Dms4GjpAA4JR4N9SJiEjs73dNgfEg@mail.gmail.com>
References: <778b6fbf-3b58-488c-9e51-32a05b95831e@isocpp.org>
 <b9004175-65ac-4a4a-847e-a474499b1e3d@isocpp.org> <e26c6071-2a98-4ca3-89d1-006e240e5a30@isocpp.org>
 <CAD6_Qj9MFG2J9UuwH_gtoKNWAEXCwirikxYF9PFRGD_8uErVgQ@mail.gmail.com> <c2355b21-614c-415e-8bb1-60f2333a9ed0@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11c3b02e3c29130501112449
X-Trace: ger.gmane.org 1408548025 8954 80.91.229.3 (20 Aug 2014 15:20:25 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 20 Aug 2014 15:20:25 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCE35H5S6IDBBMXZ2KPQKGQEIQT2SXY@isocpp.org Wed Aug 20 17:20:19 2014
Return-path: <std-proposals+bncBCE35H5S6IDBBMXZ2KPQKGQEIQT2SXY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wi0-f200.google.com ([209.85.212.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCE35H5S6IDBBMXZ2KPQKGQEIQT2SXY@isocpp.org>)
	id 1XK7gR-00051h-14
	for gclcip-std-proposals@m.gmane.org; Wed, 20 Aug 2014 17:20:19 +0200
Original-Received: by mail-wi0-f200.google.com with SMTP id d1sf3897408wiv.7
        for <gclcip-std-proposals@m.gmane.org>; Wed, 20 Aug 2014 08:20:18 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        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:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=8OOpFNh/HvH2Gg1oMcXz/5t/u+QAWrA2jf0IYOafc7Q=;
        b=LTr27iXE8LHkyvnpa0V3JdPqJdi/ZL8XW9mrRLO6E6i51LJPh9vR0TSQlpZgoBClha
         WS4LaGIkacJQIY/9YUMddBVD2lDarYMnfOivO5FtIgqdEAG9EzHDsZ9QAYHvYMQrnunr
         3nhkiFRyQ8+bTJu1lJO75EcmVfviQgvtYOO9720jM7GZhNNL+DQ/5Eon7Im/rM0j38up
         dtNtVxkLmRGHu/0hoDQ5ZwG9djgh0mN+7OQFV+9fjEywOue1uhD/4s6aTwKuHK0vcPy6
         H8wC/MDjnF/sekxpzUKWLW4MO/5vZnVvEfxFCM/mvy40GH4YBsP2H4M1lZxeaM8CN0XM
         bXGQ==
X-Gm-Message-State: ALoCoQmuwcgWwHUtosc1xxZh2OgO3rDYzK4C4ItsUO0D9mZESbjz+kH62PTZolf8epZVr6icFMj8
X-Received: by 10.180.198.172 with SMTP id jd12mr1331396wic.6.1408548018417;
        Wed, 20 Aug 2014 08:20:18 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.126.68 with SMTP id mw4ls133408wib.49.gmail; Wed, 20 Aug
 2014 08:20:17 -0700 (PDT)
X-Received: by 10.180.182.67 with SMTP id ec3mr16014432wic.21.1408548017811;
        Wed, 20 Aug 2014 08:20:17 -0700 (PDT)
Original-Received: from mail-we0-x22c.google.com (mail-we0-x22c.google.com [2a00:1450:400c:c03::22c])
        by mx.google.com with ESMTPS id h3si5087009wix.19.2014.08.20.08.20.17
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 20 Aug 2014 08:20:17 -0700 (PDT)
Received-SPF: pass (google.com: domain of nliber@gmail.com designates 2a00:1450:400c:c03::22c as permitted sender) client-ip=2a00:1450:400c:c03::22c;
Original-Received: by mail-we0-f172.google.com with SMTP id x48so8108363wes.3
        for <std-proposals@isocpp.org>; Wed, 20 Aug 2014 08:20:17 -0700 (PDT)
X-Received: by 10.194.221.74 with SMTP id qc10mr59200323wjc.39.1408548017545;
 Wed, 20 Aug 2014 08:20:17 -0700 (PDT)
Original-Sender: nliber@gmail.com
Original-Received: by 10.194.242.198 with HTTP; Wed, 20 Aug 2014 08:19:36 -0700 (PDT)
In-Reply-To: <c2355b21-614c-415e-8bb1-60f2333a9ed0@isocpp.org>
X-Original-Sender: nevin@eviloverlord.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of nliber@gmail.com designates 2a00:1450:400c:c03::22c as permitted
 sender) smtp.mail=nliber@gmail.com;       dkim=pass header.i=@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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:12380
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/12380>

--001a11c3b02e3c29130501112449
Content-Type: text/plain; charset=UTF-8

On 20 August 2014 10:12, Matthew Fioravante <fmatthew5876@gmail.com> wrote:

> I'm not sure this is actually possible for static analysis tools. There
> can be cases where you want use the value after it is moved from.
>
> auto x = std::make_unique<int>();
> if(something) {
>   v.push_back(std::move(x));
> }
> foo(x.get()); //Ok: if something was true then foo gets passed a nullptr,
> which is what we want
>

Teaching people to count on the moved-from state is a bad idea.  Generally,
you should only call functions that have no preconditions (such as
assignment and reset); otherwise, users will get confused about what
moved-from means.
-- 
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a11c3b02e3c29130501112449
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On 20 August 2014 10:12, Matthew Fioravante <span dir=3D"l=
tr">&lt;<a href=3D"mailto:fmatthew5876@gmail.com" target=3D"_blank">fmatthe=
w5876@gmail.com</a>&gt;</span> wrote:<br><div class=3D"gmail_extra"><div cl=
ass=3D"gmail_quote">

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"">I&#39;m not=
 sure this is actually possible for static analysis tools. There can be cas=
es where you want use the value after it is moved from.<br>

</div><div class=3D""><div>=C2=A0</div><div>auto x =3D std::make_unique&lt;=
int&gt;();</div></div><div>if(something) {<br>=C2=A0 v.push_back(std::move(=
x));</div><div>}</div><div>foo(x.get()); //Ok: if something was true then f=
oo gets passed a nullptr, which is what we want</div>

</div></blockquote><div><br></div><div>Teaching people to count on the move=
d-from state is a bad idea. =C2=A0Generally, you should only call functions=
 that have no preconditions (such as assignment and reset); otherwise, user=
s will get confused about what moved-from means.</div>

</div>-- <br>=C2=A0Nevin &quot;:-)&quot; Liber=C2=A0 &lt;mailto:<a href=3D"=
mailto:nevin@eviloverlord.com" target=3D"_blank">nevin@eviloverlord.com</a>=
&gt;=C2=A0 (847) 691-1404
</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 />

--001a11c3b02e3c29130501112449--

.
