220 15615 <CAOfiQqk5yhpQjd2ppbAahFHyNfc1=SJBnSqX2dWMrEb15ov94Q@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Richard Smith <richard@metafoo.co.uk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Library support for relaxed constexpr
Date: Mon, 12 Jan 2015 19:47:05 -0800
Lines: 130
Approved: news@gmane.org
Message-ID: <CAOfiQqk5yhpQjd2ppbAahFHyNfc1=SJBnSqX2dWMrEb15ov94Q@mail.gmail.com>
References: <5ccd3d6e-859c-4b66-b61c-317b704647f2@isocpp.org>
	<14072581.09eDfPqFOs@tjmaciei-mobl4>
	<9F9D7F25-F862-4358-B074-8F8C87255E2A@gmail.com>
	<2233213.JephozMv50@tjmaciei-mobl4>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=089e01294836f6f1e3050c807998
X-Trace: ger.gmane.org 1421120832 14415 80.91.229.3 (13 Jan 2015 03:47:12 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 13 Jan 2015 03:47:12 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDVNBJG4YAIBBONK2KSQKGQEQCMBURA@isocpp.org Tue Jan 13 04:47:07 2015
Return-path: <std-proposals+bncBDVNBJG4YAIBBONK2KSQKGQEQCMBURA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f197.google.com ([209.85.214.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDVNBJG4YAIBBONK2KSQKGQEQCMBURA@isocpp.org>)
	id 1YAsRe-0003iV-V8
	for gclcip-std-proposals@m.gmane.org; Tue, 13 Jan 2015 04:47:07 +0100
Original-Received: by mail-ob0-f197.google.com with SMTP id nt9sf4420971obb.0
        for <gclcip-std-proposals@m.gmane.org>; Mon, 12 Jan 2015 19:47:06 -0800 (PST)
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:date
         :message-id:subject:from:to:content-type:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=cotqtyHc2yjQ9xU36wyVojVE9YwGyqc/qcdaQBzWz+g=;
        b=e98Jo7fxeiHCFf7VcgOPrkLS7R7H4aIBwEWHdS1XNMZTZ38m3D8Bmvh1kNil9Ay8Kt
         IM4kOdI9NtgtksZ/rrNNOQ2DE+593Ggs4EXL2A1XzYVkrv9MaoF12nzRiBNR+xf1y3r0
         Yegbcuc+HPm6uUmXti4CtrbAgPZbS59L9EaNxfgFBtr5EXpAvz9bJfi//m6y5Ib12YQk
         DT629QJ6SrLLHan9QqwrgUvGewiQ9znM1DF9Cs2Z+EqwUlwB1Qj5tVT4DjHblt52pJHC
         e7pqLc6o/Ab7gFEmhwf0heNy364h37O+f8CqRVccKAhz1sb9pKouMjPhRwwtJy//++DO
         tz2A==
X-Gm-Message-State: ALoCoQlkm1jtQqX9w4D0IDEf6iLLAAnifzY2NHumqCCbnp4EbMHwz4q+bGfyZZJbU/0JoUvINDec
X-Received: by 10.43.99.202 with SMTP id ct10mr27168203icc.29.1421120825881;
        Mon, 12 Jan 2015 19:47:05 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.61.137 with SMTP id p9ls982101igr.38.canary; Mon, 12 Jan
 2015 19:47:05 -0800 (PST)
X-Received: by 10.42.209.196 with SMTP id gh4mr27462871icb.10.1421120825319;
        Mon, 12 Jan 2015 19:47:05 -0800 (PST)
Original-Received: from mail-ig0-x22b.google.com (mail-ig0-x22b.google.com. [2607:f8b0:4001:c05::22b])
        by mx.google.com with ESMTPS id 15si13095602ioj.14.2015.01.12.19.47.05
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Mon, 12 Jan 2015 19:47:05 -0800 (PST)
Received-SPF: pass (google.com: domain of metafoo@gmail.com designates 2607:f8b0:4001:c05::22b as permitted sender) client-ip=2607:f8b0:4001:c05::22b;
Original-Received: by mail-ig0-f171.google.com with SMTP id z20so15005325igj.4
        for <std-proposals@isocpp.org>; Mon, 12 Jan 2015 19:47:05 -0800 (PST)
X-Received: by 10.50.73.136 with SMTP id l8mr18739271igv.5.1421120825125; Mon,
 12 Jan 2015 19:47:05 -0800 (PST)
Original-Sender: metafoo@gmail.com
Original-Received: by 10.107.136.223 with HTTP; Mon, 12 Jan 2015 19:47:05 -0800 (PST)
In-Reply-To: <2233213.JephozMv50@tjmaciei-mobl4>
X-Original-Sender: richard@metafoo.co.uk
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of metafoo@gmail.com designates 2607:f8b0:4001:c05::22b as permitted
 sender) smtp.mail=metafoo@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:15615
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/15615>

--089e01294836f6f1e3050c807998
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Mon, Jan 12, 2015 at 7:01 PM, Thiago Macieira <thiago@macieira.org>
wrote:

> On Tuesday 13 January 2015 09:18:13 David Krauss wrote:
> > > On 2015=E2=80=9301=E2=80=9313, at 6:43 AM, Thiago Macieira <thiago@ma=
cieira.org>
> wrote:
> > >
> > > Note that the difference is whether the intrinsic functions are
> considered
> >
> > > constexpr or not. For GCC, __builtin_ldexp is constexpr but isn't for
> Clang:
> > For GCC, most of <cmath> is constexpr because it has supported
> compile-time
> > evaluation of constant floating-point expressions since time immemorial=
..
> > Only in C++11 (once constexpr extensions were forbidden) did this
> extension
> > become nonconforming.
> >
> > I almost finished a paper for Urbana, =E2=80=9CRefining floating-point
> constexpr,=E2=80=9D
> > but ultimately I had enough other material, and the implementations kep=
t
> > evolving under my feet. I should finish it and find a presenter for
> Lenexa.
> > Co-authors are welcome!
>
> I believe you should leave those functions in cmath be optionally
> constexpr.
> Compilers do not have to make them constexpr if they are not equipped for
> evaluating them at compile time, like GCC was.


It doesn't seem unreasonable to require more of C++17 implementations. I
think it's much better to make the functions unconditionally constexpr and
require the implementations to do the right thing.

One consideration, though: C supports controlling the floating point
environment in various ways, and C++ pays lipservice to this by providing
the <cfenv> header. If we ever start also supporting "#pragma STDC
FENV_ACCESS" and following the C rules here (which seems like a very bad
idea, but we're already half-way there) then that will have "interesting"
interactions with compile-time evaluation of floating-point expressions.

--=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/.

--089e01294836f6f1e3050c807998
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On M=
on, Jan 12, 2015 at 7:01 PM, Thiago Macieira <span dir=3D"ltr">&lt;<a href=
=3D"mailto:thiago@macieira.org" target=3D"_blank">thiago@macieira.org</a>&g=
t;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0=
 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=3D"">On Tues=
day 13 January 2015 09:18:13 David Krauss wrote:<br>
&gt; &gt; On 2015=E2=80=9301=E2=80=9313, at 6:43 AM, Thiago Macieira &lt;<a=
 href=3D"mailto:thiago@macieira.org">thiago@macieira.org</a>&gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt; Note that the difference is whether the intrinsic functions are c=
onsidered<br>
&gt;<br>
&gt; &gt; constexpr or not. For GCC, __builtin_ldexp is constexpr but isn&#=
39;t for<br>
Clang:<br>
&gt; For GCC, most of &lt;cmath&gt; is constexpr because it has supported c=
ompile-time<br>
&gt; evaluation of constant floating-point expressions since time immemoria=
l.<br>
&gt; Only in C++11 (once constexpr extensions were forbidden) did this exte=
nsion<br>
&gt; become nonconforming.<br>
&gt;<br>
&gt; I almost finished a paper for Urbana, =E2=80=9CRefining floating-point=
 constexpr,=E2=80=9D<br>
&gt; but ultimately I had enough other material, and the implementations ke=
pt<br>
&gt; evolving under my feet. I should finish it and find a presenter for Le=
nexa.<br>
&gt; Co-authors are welcome!<br>
<br>
</span>I believe you should leave those functions in cmath be optionally co=
nstexpr.<br>
Compilers do not have to make them constexpr if they are not equipped for<b=
r>
evaluating them at compile time, like GCC was.</blockquote><div><br></div><=
div>It doesn&#39;t seem unreasonable to require more of C++17 implementatio=
ns. I think it&#39;s much better to make the functions unconditionally cons=
texpr and require the implementations to do the right thing.</div><div><br>=
</div><div>One consideration, though: C supports controlling the floating p=
oint environment in various ways, and C++ pays lipservice to this by provid=
ing the &lt;cfenv&gt; header. If we ever start also supporting &quot;#pragm=
a STDC FENV_ACCESS&quot; and following the C rules here (which seems like a=
 very bad idea, but we&#39;re already half-way there) then that will have &=
quot;interesting&quot; interactions with compile-time evaluation of floatin=
g-point expressions.</div></div></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 />

--089e01294836f6f1e3050c807998--

.
