220 4886 <CAFfXxVu8HH9O=uN=KCw_woBLS_NyN=0zXXVqO+o-brSO7M1T1Q@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: James Dennett <jdennett@google.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Proposal: std::sequence
Date: Wed, 5 Jun 2013 00:04:36 -0700
Lines: 48
Approved: news@gmane.org
Message-ID: <CAFfXxVu8HH9O=uN=KCw_woBLS_NyN=0zXXVqO+o-brSO7M1T1Q@mail.gmail.com>
References: <4551abbc-43aa-4520-a91a-f8eb25a90588@isocpp.org>
	<e915df62-4930-48ee-a8ac-64261c407234@isocpp.org>
	<2c8e6079-9c87-425a-93e2-39251df57cd8@isocpp.org>
	<CANh-dX=va9uLSbvQc_TRmf8o5TDzQutmkxJDc64g7b=yKyN7sg@mail.gmail.com>
	<9f1cace3-0503-4a3c-a8ce-d7546564b3ef@isocpp.org>
	<a6f024b6-45d6-4c3b-b8a6-3f056aeab51f@isocpp.org>
	<c029551c-241c-4809-adaa-7908434ba10d@isocpp.org>
	<ed3c548d-b470-47ec-850e-95d3c11e29a8@isocpp.org>
	<1c991e6e-6bc3-4822-9ffd-7f2508e63974@isocpp.org>
	<CADfx-VTw0ArZ3+JbD=Vv+o9ncwNp9miYy5RD9XXeOFGEE3N0MQ@mail.gmail.com>
	<etPan.51ae6e0b.238e1f29.8d5@server-2.private>
	<CANh-dX=zKENwN_sS84HHOuzeug0NqDiJ0w4D8FtEWFYYhMbfAg@mail.gmail.com>
	<CAGsORuBjtg1GO4ink+yS6Gy6ZsmBr2EO3Ax46uOMVRKTZat=pQ@mail.gmail.com>
	<CANh-dXm9u+Sd_k+Ld19PpYBzTo-VM_Ur32wxKxk3DJcCiUKdng@mail.gmail.com>
	<CAGsORuCy2vonmjfha3XaUge4OKCW_EtheZqspMRfG0cne6uc7A@mail.gmail.com>
	<CANh-dX=4BbGOaMPzHG2nQw3NScYCWhCGntnyyFA9iiweC2mV6w@mail.gmail.com>
	<CAGsORuANw6cgQYKSxJhKAEd8F+8_=ObHJcnE33OPLYs7dCYsUw@mail.gmail.com>
	<CAGg_6+NQ_zDUZrfcwEBKcCUXs=vtF4q6dkU527BNEKAbW0tW+Q@mail.gmail.com>
	<CAGsORuDcF35cyHfM-_bPeSaon80SOD=i7aBmvZo1-rThnVJVPg@mail.gmail.com>
	<CAFfXxVteQWys1D1ZEKjmePM7kb7kWR1SUV2fYpMEGL_Y8wGwBA@mail.gmail.com>
	<CAGsORuCcEtYFjO7un8OjhkfP4cn0T_=MALpF3D6cU+bBwrPV-A@mail.gmail.com>
	<CANh-dXmpdhmRYfXzTA18y03i_m_v-1Nesw00FiZj=1=g4g3+4g@mail.gmail.com>
	<CAGsORuAJfP2mwTyQgon3jh8-=XDxO-2+r32arHzPeTBm9=rPLw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1370415878 3439 80.91.229.3 (5 Jun 2013 07:04:38 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 5 Jun 2013 07:04:38 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBD3JZ2GYRAKRBBOGXOGQKGQEUT7Y57Y@isocpp.org Wed Jun 05 09:04:39 2013
Return-path: <std-proposals+bncBD3JZ2GYRAKRBBOGXOGQKGQEUT7Y57Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f198.google.com ([209.85.214.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBD3JZ2GYRAKRBBOGXOGQKGQEUT7Y57Y@isocpp.org>)
	id 1Uk7lu-0007DY-V1
	for gclcip-std-proposals@m.gmane.org; Wed, 05 Jun 2013 09:04:39 +0200
Original-Received: by mail-ob0-f198.google.com with SMTP id up14sf6265133obb.1
        for <gclcip-std-proposals@m.gmane.org>; Wed, 05 Jun 2013 00:04:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=google.com; s=20120113;
        h=x-beenthere:mime-version:in-reply-to:references:date:message-id
         :subject:from:to:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:x-google-group-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=lgPDIokgI8NUtANChaqtxYdBVwaeOrtmgsgqVmmRBwA=;
        b=HPi4wDC5E1AXkJ+yInulgpnlDHQIpqzKHq0BhZRiSs+9jixn4n9W2Wjh8X+VYXfnwo
         /c5+qRXQGQoaENBjPPlW4epp9fWnbJQgIA7H9yApeHcVuUmNbkpA9brcW1fjHdT78/Xi
         Rh5SA81jm8IyYQ2nzWWhL82hIiv7775TH2axDl7P7yp5qOQIviDwbp+7uEj80x++beFo
         2UEl7pCqMT9qMubFc4wX0EL78zJPa/9etYBgxJ3V4CbJXqzzKZ4nY6cVrtGBImmpEzy8
         H1JO6ub4HGBjIrrUJAoIt7gIhzJlvN/s3mc13EzOPps09wq2UCmFAZ/FKbXmhHiEQ95O
         mhuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=google.com; s=20120113;
        h=x-beenthere:mime-version:in-reply-to:references:date:message-id
         :subject:from:to:x-gm-message-state:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-google-group-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=lgPDIokgI8NUtANChaqtxYdBVwaeOrtmgsgqVmmRBwA=;
        b=oF8FWcF2pDuQNhK5SAL3McYMrEmQ3Y6cqAJcRGsSZ68MbXWbGBlJ42hX5HWRbXCZYx
         7hRVTZAuj1Z21m1vtKyjOrRVW9B0Tp2wf2ak5kkpxHC48qtg+hFixrpNvTXLLR9Lm8zz
         W1OGQF+vJJYcS2b5/Cdp2FnapX2T/Jin8qpXOlci8umUzqEmyNB42YsDN0VA574h/xKF
         GvIxhB63uWFvY0uknV+HVgSMhylw8+plFldTJPlHRpFcptx3C9s8V+rLS0C/tkSMeNx/
         893L+3bpoRhHBWnvd5B4Vx8lVUbMyv9BPPbH36sVdAX9pV71bQlnD9uPrvvMxsnzhBhM
         uKnQ==
X-Received: by 10.182.29.201 with SMTP id m9mr7123764obh.43.1370415877892;
        Wed, 05 Jun 2013 00:04:37 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.99.168 with SMTP id er8ls80510obb.58.gmail; Wed, 05 Jun
 2013 00:04:36 -0700 (PDT)
X-Received: by 10.60.39.165 with SMTP id q5mr8853903oek.109.1370415876880;
        Wed, 05 Jun 2013 00:04:36 -0700 (PDT)
Original-Received: from mail-ie0-x22c.google.com (mail-ie0-x22c.google.com [2607:f8b0:4001:c03::22c])
        by mx.google.com with ESMTPS id zb4si29610462obb.62.2013.06.05.00.04.36
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 05 Jun 2013 00:04:36 -0700 (PDT)
Received-SPF: pass (google.com: domain of jdennett@google.com designates 2607:f8b0:4001:c03::22c as permitted sender) client-ip=2607:f8b0:4001:c03::22c;
Original-Received: by mail-ie0-f172.google.com with SMTP id 17so2818888iea.3
        for <std-proposals@isocpp.org>; Wed, 05 Jun 2013 00:04:36 -0700 (PDT)
X-Received: by 10.50.39.35 with SMTP id m3mr2568426igk.42.1370415876409; Wed,
 05 Jun 2013 00:04:36 -0700 (PDT)
Original-Received: by 10.231.73.130 with HTTP; Wed, 5 Jun 2013 00:04:36 -0700 (PDT)
In-Reply-To: <CAGsORuAJfP2mwTyQgon3jh8-=XDxO-2+r32arHzPeTBm9=rPLw@mail.gmail.com>
X-Gm-Message-State: ALoCoQlZ9TK6Kakw45gxuq4MJVr5nIYz9APgqTz0uc5AH5hI6CYpgiYRs2748kWfjB1dLgYndiTSqBaBZlhiGS9So/CzI1mIuUbj3j2pFu21x6y/PDkLxETJfr7iUjrZ82fjXCn0ulurazW03QFdtGZ/XeTT5M6rH6k1EAIxaR8Q+CVLUUriwvum/djBmnYM3FcmQYHzYK1FzKekxoVBBEynwOWOn+zh6w==
X-Original-Sender: jdennett@google.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of jdennett@google.com designates 2607:f8b0:4001:c03::22c as permitted
 sender) smtp.mail=jdennett@google.com;       dkim=pass header.i=@google.com;
       dmarc=pass (p=REJECT dis=none) d=google.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?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:4886
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/4886>

On Tue, Jun 4, 2013 at 11:27 PM, Zhihao Yuan <lichray@gmail.com> wrote:
> On Wed, Jun 5, 2013 at 1:36 AM, Jeffrey Yasskin <jyasskin@google.com> wrote:
>> James is saying what compilers are allowed to do.

Yes.

> "because they optimize away"... there is no "can" here, so
> I assume his purpose is to say "he knows it".

That's not a correct understanding of the sentence, but that's not
very important.

>> You've observed that
>> gcc and clang do not yet actually do it. Your observation doesn't mean
>> they aren't allowed to do it, and if you care at all about the people
>> who'll be maintaining your code in the future, you shouldn't code as
>> if they won't do it in the future.
>
> They are allowed to do, yes, in this specific case, but what I'm
> explaining is why they do not do (and probably will never do),
> because analyzing the control flow is much easier and can
> cover more useful cases, and since the const-correctness does
> not help de-aliasing at all, the compilers just do not use the
> information (for short, the SSA passed to clang optimizer
> just do not have constness).  I'm pretty much sure there is
> no future for these kind of analysis.

I have seen real compilers do similar optimizations that do depend on
const, and I've seen beginners be puzzled by the results (e.g., when
printing the same variable gives two different results at same time,
because the compilers has used the original value in some cases but
not in others).

In my opinion this is drifting off-topic for this thread, and indeed
this forum, so I'll bow out now.

-- James

-- 

--- 
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/?hl=en.



.
