220 10141 <533B0135.2090701@gmail.com> article
Path: news.gmane.org!not-for-mail
From: "Paul A. Tessier" <phernost@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Shouldn't the constexpr variables be treated as
 static by default?
Date: Tue, 01 Apr 2014 14:11:01 -0400
Lines: 136
Approved: news@gmane.org
Message-ID: <533B0135.2090701@gmail.com>
References: <21e34045-b833-4468-a39e-dbf177938012@isocpp.org>	<6838b332-f256-45e7-894b-7cba3593d789@isocpp.org>	<CA+cyFgspwkCxgc10Gg0ZchetPB2MUfd0z0ji9SNimzpGva5EWQ@mail.gmail.com>	<4271540.MD85hg9ecn@tjmaciei-mobl4> <CAOfiQqnHgctE8Wgq3v-aDH-dRoY98Bodgg4n82m3vqLBDo6w7g@mail.gmail.com> <533939DD.7080200@gmail.com> <B2799926-D60C-43C4-A06A-C1796C33B4B8@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------010605070300050201030905"
X-Trace: ger.gmane.org 1396375878 24435 80.91.229.3 (1 Apr 2014 18:11:18 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 1 Apr 2014 18:11:18 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDDYTQX56INBBNUC5SMQKGQEPRDVKUY@isocpp.org Tue Apr 01 20:11:11 2014
Return-path: <std-proposals+bncBDDYTQX56INBBNUC5SMQKGQEPRDVKUY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wg0-f69.google.com ([74.125.82.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDDYTQX56INBBNUC5SMQKGQEPRDVKUY@isocpp.org>)
	id 1WV39M-0007oL-1i
	for gclcip-std-proposals@m.gmane.org; Tue, 01 Apr 2014 20:11:04 +0200
Original-Received: by mail-wg0-f69.google.com with SMTP id x13sf17065086wgg.4
        for <gclcip-std-proposals@m.gmane.org>; Tue, 01 Apr 2014 11:11:03 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references:in-reply-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=ny2wv8eZCymgn2Be2B8I404Z9ScLjR+EaQad2lIPk5I=;
        b=Kb9Y8k7hkTqS7fu+Es76yPtqxhrRI/H9TYOOi52EePmYF5vtFhxIsxHp5KidfbeSa4
         yTNHyMr3f9BqCf9EvcuLCUrX1az7C9VFCJhekzDtJVUtasjjeUpfUH+EJrX5s8HDzq+o
         PxTxWMAJRqyQl3iPjbiRx+QCTF/PBW8K1uKOK3XOoxBMgotCYA4k5sQTaq+4boKsldY9
         Nlbk4Rv1HE/fvrD9PHhYuLp2Rc1uXedpY0dj1mUt1Mdmz58F5JrxNweXPY9W3pSPoDmt
         G6CfGPBDj02Dlp9H/2Cmid7pPnABXrHwbXEqAtcgryUoGN/5RPVNT+iqDJrKvHu//yCe
         svWA==
X-Gm-Message-State: ALoCoQluhRMd1bcNZP9OEu7vymbLw60Mvsrm1LTY+1jNpbelt9ZvjiNNPfRO/k2HiD+hC8KTDyeY
X-Received: by 10.15.26.9 with SMTP id m9mr14429098eeu.3.1396375863594;
        Tue, 01 Apr 2014 11:11:03 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.101.245 with SMTP id u108ls83999qge.79.gmail; Tue, 01 Apr
 2014 11:11:02 -0700 (PDT)
X-Received: by 10.224.30.70 with SMTP id t6mr37560605qac.30.1396375862576;
        Tue, 01 Apr 2014 11:11:02 -0700 (PDT)
Original-Received: from mail-qc0-x22c.google.com (mail-qc0-x22c.google.com [2607:f8b0:400d:c01::22c])
        by mx.google.com with ESMTPS id a3si3284334qat.212.2014.04.01.11.11.02
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 01 Apr 2014 11:11:02 -0700 (PDT)
Received-SPF: pass (google.com: domain of phernost@gmail.com designates 2607:f8b0:400d:c01::22c as permitted sender) client-ip=2607:f8b0:400d:c01::22c;
Original-Received: by mail-qc0-f172.google.com with SMTP id i8so11185764qcq.3
        for <std-proposals@isocpp.org>; Tue, 01 Apr 2014 11:11:02 -0700 (PDT)
X-Received: by 10.224.14.14 with SMTP id e14mr17325532qaa.80.1396375862449;
        Tue, 01 Apr 2014 11:11:02 -0700 (PDT)
Original-Received: from [192.168.0.150] (c-71-192-182-216.hsd1.ma.comcast.net. [71.192.182.216])
        by mx.google.com with ESMTPSA id t9sm36164048qar.15.2014.04.01.11.11.01
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 01 Apr 2014 11:11:02 -0700 (PDT)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
In-Reply-To: <B2799926-D60C-43C4-A06A-C1796C33B4B8@gmail.com>
X-Original-Sender: phernost@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of phernost@gmail.com designates 2607:f8b0:400d:c01::22c as permitted
 sender) smtp.mail=phernost@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (p=NONE dis=NONE) header.from=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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:10141
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/10141>

This is a multi-part message in MIME format.
--------------010605070300050201030905
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

On 04/01/2014 01:46 PM, David Krauss wrote:
>
> On 2014=E2=80=9303=E2=80=9331, at 5:48 PM, Paul A. Tessier <phernost@gmai=
l.com=20
> <mailto:phernost@gmail.com>> wrote:
>
>> A constexpr variable *must* have static storage at some point, it's=20
>> baked in when the program is compiled. Allowing it to be treated as=20
>> non-static creates a weird set of corner cases.
>
> I=E2=80=99m pretty sure you=E2=80=99re allowed to embed runtime data in a=
 constexpr=20
> object using mutable.
>
> This thread does touch on the behavior of extern constexpr, which I=20
> believe to be a defect=E2=80=A6 need to write a paper=E2=80=A6
>
>

You still'd get a copy from the immutable static version. The copy just=20
happens to have a mutable field, which in my opinion isn't really=20
constexpr object as much as it is a const object with a mutable field.

Were basically stuck with poor semantics and too much variability on=20
something that has hard defined limits. All constexpr objects have=20
static storage, irregardless of extra features that confound their use.=20
Therefore I believe the syntax should be cleaned to show this, but we're=20
probably too far into the weeds now to ever fix this in a clear and=20
concise manner. Making all constexpr objects static by default is at=20
least a step in the right direction.

--=20

---=20
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 e=
mail 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-proposa=
ls/.

--------------010605070300050201030905
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3DUTF-8" http-equiv=3D"Content-Type=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div class=3D"moz-cite-prefix">On 04/01/2014 01:46 PM, David Krauss
      wrote:<br>
    </div>
    <blockquote
      cite=3D"mid:B2799926-D60C-43C4-A06A-C1796C33B4B8@gmail.com"
      type=3D"cite">
      <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF=
-8">
      <br>
      <div>
        <div>On 2014=E2=80=9303=E2=80=9331, at 5:48 PM, Paul A. Tessier &lt=
;<a
            moz-do-not-send=3D"true" href=3D"mailto:phernost@gmail.com">phe=
rnost@gmail.com</a>&gt;
          wrote:</div>
        <br class=3D"Apple-interchange-newline">
        <blockquote type=3D"cite">
          <meta content=3D"text/html; charset=3DUTF-8"
            http-equiv=3D"Content-Type">
          <div bgcolor=3D"#FFFFFF" text=3D"#000000">
            <div class=3D"moz-cite-prefix">A constexpr variable <b>must</b>
              have static storage at some point, it's baked in when the
              program is compiled. Allowing it to be treated as
              non-static creates a weird set of corner cases.</div>
          </div>
        </blockquote>
      </div>
      <br>
      <div>I=E2=80=99m pretty sure you=E2=80=99re allowed to embed runtime =
data in a
        constexpr object using <font face=3D"Courier">mutable</font>.</div>
      <div><br>
      </div>
      <div>This thread does touch on the behavior of=C2=A0<font
          face=3D"Courier">extern constexpr</font>, which I believe to be
        a defect=E2=80=A6 need to write a paper=E2=80=A6</div>
      <div><br>
      </div>
      <br>
    </blockquote>
    <br>
    You still'd get a copy from the immutable static version. The copy
    just happens to have a <font face=3D"Courier">mutable</font> field,
    which in my opinion isn't really <font face=3D"Courier">constexpr</font=
>
    object as much as it is a <font face=3D"Courier">const</font> object
    with a <font face=3D"Courier">mutable</font> field.<br>
    <br>
    Were basically stuck with poor semantics and too much variability on
    something that has hard defined limits. All <font face=3D"Courier">cons=
texpr</font>
    objects have static storage, irregardless of extra features that
    confound their use. Therefore I believe the syntax should be cleaned
    to show this, but we're probably too far into the weeds now to ever
    fix this in a clear and concise manner. Making all <font
      face=3D"Courier">constexpr</font> objects static by default is at
    least a step in the right direction.<br>
    <br>
  </body>
</html>

<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 />

--------------010605070300050201030905--

.
