220 12731 <7e67bd2a-1a06-4ee7-8f21-8b2f8bfeeb84@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Matthew Fioravante <fmatthew5876@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Local variables that overstay their welcome
Date: Mon, 8 Sep 2014 10:54:47 -0700 (PDT)
Lines: 71
Approved: news@gmane.org
Message-ID: <7e67bd2a-1a06-4ee7-8f21-8b2f8bfeeb84@isocpp.org>
References: <778b6fbf-3b58-488c-9e51-32a05b95831e@isocpp.org>
 <94e564fc-f769-48d0-8a61-264f9c8f8480@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_765_1913358570.1410198888010"
X-Trace: ger.gmane.org 1410198899 5288 80.91.229.3 (8 Sep 2014 17:54:59 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 8 Sep 2014 17:54:59 +0000 (UTC)
Cc: rgumpertz@gmail.com
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDELF54RTIGRB2G2W6QAKGQEC3ZZKQI@isocpp.org Mon Sep 08 19:54:50 2014
Return-path: <std-proposals+bncBDELF54RTIGRB2G2W6QAKGQEC3ZZKQI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pd0-f199.google.com ([209.85.192.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDELF54RTIGRB2G2W6QAKGQEC3ZZKQI@isocpp.org>)
	id 1XR39O-0008KC-AC
	for gclcip-std-proposals@m.gmane.org; Mon, 08 Sep 2014 19:54:50 +0200
Original-Received: by mail-pd0-f199.google.com with SMTP id v10sf36117243pde.6
        for <gclcip-std-proposals@m.gmane.org>; Mon, 08 Sep 2014 10:54:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=tFJKj0dSlUzaRX9U1Uq5yRCLYSGjZk8WoudjdeN4mHI=;
        b=0aJ4300I/Kje7SCLffXTiq60MdYBbp9rD+48Ws0VXlb+UzT/3wFhFFWDpSvLL9jpTF
         QLF9ObTuzZQ9UuC40umIHbWiU5aSvCfHj95gl33lhDDgrgfN4f7694zfTEtKxIE5oza4
         +IXsENGUpNXwyuNLI6kCRvkFPyHWB+6FcV/uZ+JeJSQmvnNWian+IHDXZVuRdzDJGara
         XRimjX/I3ZW/+MDRivH5uwySHpBBL/HZfIC8cTCcI280svOQKICwKV+pKYyrKIAOVUl8
         KhziHh4koOccjyzD/Iwg+3mTS/eN2k7YVkMUwdUyae6E67PTF8iB5EVqfYBiVxwWntPB
         3Pxg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=tFJKj0dSlUzaRX9U1Uq5yRCLYSGjZk8WoudjdeN4mHI=;
        b=QbqXhNil/1Q8XkD9Qs8M7hLAtmL7T+qljXnN9AATRpPnaroXEhrJPnyXIKIfPRHnZG
         jDVUMXpmDD7z7a0um7l+5rll2SRhArNRnWWTTVw/etDMrm5wTCtRcUKHwodILrlMTng3
         uiyhRK3xkAnGr2dbyW4enS+s3IeGBEH8LSUU7tIPYP3JfsKJWhkINvOHR0gNvuqh0Y/U
         8bMcbLarfEgDGDSIy4Abv15eb4j1CONoNHJURM/0H/PU3hfjAcvmDP37Jq5c8fyIVA0y
         /Ku1Xy8gsGfmsTOKdqRL0fCRBNZokT6R6jnB31gyhuoufJAhdG6wgIyWXRRvY6QFrnIa
         Qn8Q==
X-Gm-Message-State: ALoCoQn9C8YKuY6yI69lzPbFurCdh5tqVhto0FsFHU+T/yGhklYVaoS6zoPA1BXTZtYvY0ejTxfx
X-Received: by 10.66.162.162 with SMTP id yb2mr8410558pab.39.1410198889231;
        Mon, 08 Sep 2014 10:54:49 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.96.42 with SMTP id j39ls1805142qge.89.gmail; Mon, 08 Sep
 2014 10:54:48 -0700 (PDT)
X-Received: by 10.140.18.161 with SMTP id 30mr22362qgf.31.1410198888491;
        Mon, 08 Sep 2014 10:54:48 -0700 (PDT)
In-Reply-To: <94e564fc-f769-48d0-8a61-264f9c8f8480@isocpp.org>
X-Original-Sender: fmatthew5876@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:12731
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/12731>

------=_Part_765_1913358570.1410198888010
Content-Type: text/plain; charset=UTF-8



On Sunday, September 7, 2014 6:31:13 PM UTC-4, rgum...@gmail.com wrote:
>
> It looks to me like this is one case of a more general desire:
>     (1) tell the compiler that a local variable should be treated as const 
> for the remainder of the containing block
>

That could easily be implemented using the current proposal:

Foo x;
//do non-const stuff with x
const auto& xc = x;
kill x;
//do const operations on xc

I think changing the type of x itself to be const in the middle of the 
block would be a very bad idea. It makes the code very hard to read if the 
type can change anywhere. Also it could have disastrous consequences for 
templates.

 

-- 

--- 
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/.

------=_Part_765_1913358570.1410198888010
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Sunday, September 7, 2014 6:31:13 PM UTC-4, rgu=
m...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;m=
argin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><div dir=3D"ltr"><div>It looks to me like this is one case of a mo=
re general desire:<br>&nbsp;&nbsp;&nbsp; (1) tell the compiler that a local=
 variable should be treated as const for the remainder of the containing bl=
ock<br></div></div></div></blockquote><div><br>That could easily be impleme=
nted using the current proposal:<br><br>Foo x;<br>//do non-const stuff with=
 x<br>const auto&amp; xc =3D x;<br>kill x;<br>//do const operations on xc<b=
r><br>I think changing the type of x itself to be const in the middle of th=
e block would be a very bad idea. It makes the code very hard to read if th=
e type can change anywhere. Also it could have disastrous consequences for =
templates.<br><br>&nbsp;</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 />

------=_Part_765_1913358570.1410198888010--

.
