220 4873 <CAGsORuANw6cgQYKSxJhKAEd8F+8_=ObHJcnE33OPLYs7dCYsUw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Zhihao Yuan <lichray@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Proposal: std::sequence
Date: Tue, 4 Jun 2013 21:06:11 -0400
Lines: 43
Approved: news@gmane.org
Message-ID: <CAGsORuANw6cgQYKSxJhKAEd8F+8_=ObHJcnE33OPLYs7dCYsUw@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>
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 1370394374 11849 80.91.229.3 (5 Jun 2013 01:06:14 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 5 Jun 2013 01:06:14 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCUILMGRQMARBBE6XKGQKGQERASKP4Q@isocpp.org Wed Jun 05 03:06:14 2013
Return-path: <std-proposals+bncBCUILMGRQMARBBE6XKGQKGQERASKP4Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ea0-f200.google.com ([209.85.215.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCUILMGRQMARBBE6XKGQKGQERASKP4Q@isocpp.org>)
	id 1Uk2B3-0001p3-Ef
	for gclcip-std-proposals@m.gmane.org; Wed, 05 Jun 2013 03:06:13 +0200
Original-Received: by mail-ea0-f200.google.com with SMTP id q15sf867013ead.11
        for <gclcip-std-proposals@m.gmane.org>; Tue, 04 Jun 2013 18:06:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.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=ZTDkDeeRFFsIZ9XbM4n/h79fmXMBOY6iVbkSw4TNiD4=;
        b=nWn0MuqeQgecI9h5yjT4SITF5BM7Q/MS2tkM47YGk5RyTiUb1AA2EsvkSSWqhME5SW
         8ZD6MKPy2Uvvg5tAHpKk7v8VVwFEVU9/BM18J3q+vimkkw4avKmtEmJ/lvBOzKB0HsQh
         Hco+HIpV6cPgVgRQRITGFFYlBVFBiJOe41lRCWHHW9Ae4DiUrjOkZYlCT0mI3/FUMlJ3
         kGhcmKsO7h5WCw8XMwp/sFTaMWSlHSTiu/nbaWUbXSjGUG5gHWpZBZEf1V9QRrrrel8b
         DwmHoemuE1WvHBlc+mOwDxpsRcUkCtjPArUCa3C+kqgkzcSBbOijl7mMgL6Sh2AHKDDH
         sCgQ==
X-Received: by 10.152.28.69 with SMTP id z5mr7102400lag.5.1370394372828;
        Tue, 04 Jun 2013 18:06:12 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.29.233 with SMTP id n9ls37058lah.101.gmail; Tue, 04 Jun
 2013 18:06:11 -0700 (PDT)
X-Received: by 10.152.121.73 with SMTP id li9mr14130286lab.18.1370394371905;
        Tue, 04 Jun 2013 18:06:11 -0700 (PDT)
Original-Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com [209.85.217.169])
        by mx.google.com with ESMTPS id o7si12122941lae.142.2013.06.04.18.06.11
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 04 Jun 2013 18:06:11 -0700 (PDT)
Received-SPF: pass (google.com: domain of lichray@gmail.com designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169;
Original-Received: by mail-lb0-f169.google.com with SMTP id d10so1335633lbj.14
        for <std-proposals@isocpp.org>; Tue, 04 Jun 2013 18:06:11 -0700 (PDT)
X-Received: by 10.112.201.67 with SMTP id jy3mr13150420lbc.75.1370394371509;
 Tue, 04 Jun 2013 18:06:11 -0700 (PDT)
Original-Received: by 10.112.146.99 with HTTP; Tue, 4 Jun 2013 18:06:11 -0700 (PDT)
In-Reply-To: <CANh-dX=4BbGOaMPzHG2nQw3NScYCWhCGntnyyFA9iiweC2mV6w@mail.gmail.com>
X-Original-Sender: lichray@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of lichray@gmail.com designates 209.85.217.169 as permitted sender)
 smtp.mail=lichray@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?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:4873
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/4873>

On Tue, Jun 4, 2013 at 8:25 PM, Jeffrey Yasskin <jyasskin@google.com> wrote:
> See "The only time const might allow optimizations" in the very
> article you linked to.

This is for a different reason: the compiler regards the value as a
real 'constant', but distinguishes it from a 'real' 'real' one defined
in language (and this is why the `constexpr` keyword is there).

Try this:

struct A {
    A() : x(10) {}
    int x;
};

void f(int* x) {
    std::cin >> *x;
}

int main() {
    A a;
    f((int*)&a);
    std::cout << a.x;
}

Then you will find that the 'optimization' no longer works.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://4bsd.biz/

-- 

--- 
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.



.
