220 39050 <CALvx3hZ8bNfWMYvzty1Dzh6OXs029k5t-nr1m1nP9uCgisA21Q@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Richard Hodges <hodges.r@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: constexpr! or constexpr(true)
Date: Tue, 10 Jul 2018 09:06:30 +0200
Lines: 199
Approved: news@gmane.org
Message-ID: <CALvx3hZ8bNfWMYvzty1Dzh6OXs029k5t-nr1m1nP9uCgisA21Q@mail.gmail.com>
References: <f377a21c-926e-4cd8-9c25-5c36b7a7a62c@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="000000000000a32dcb05709fc596"
X-Trace: blaine.gmane.org 1531206277 16022 195.159.176.226 (10 Jul 2018 07:04:37 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 10 Jul 2018 07:04:37 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBD4PBM7UWAHRBAVWSHNAKGQERGORHFQ@isocpp.org Tue Jul 10 09:04:33 2018
Return-path: <std-proposals+bncBD4PBM7UWAHRBAVWSHNAKGQERGORHFQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f197.google.com ([209.85.223.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBD4PBM7UWAHRBAVWSHNAKGQERGORHFQ@isocpp.org>)
	id 1fcmhM-000450-B2
	for gclcip-std-proposals@m.gmane.org; Tue, 10 Jul 2018 09:04:32 +0200
Original-Received: by mail-io0-f197.google.com with SMTP id t23-v6sf18611381ioa.9
        for <gclcip-std-proposals@m.gmane.org>; Tue, 10 Jul 2018 00:06:43 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1531206403; cv=pass;
        d=google.com; s=arc-20160816;
        b=TCJ7fB9Zu4dVMGkqB1EpfmDD68rukKjVqtK9WmBmhshIj8qywECXfU3/QGQytgvtJb
         toFDAtJxZWkGdDj0f7IMm8AgDtOeaIxmMRk34wKtNjxMcCx4S3Tqn7m7eExrOlC9YydW
         bYSVCW8uYQrQC4u6gH0adu9DqPDgm+hFT0BUB5iMCCH9TXe+nOIelqOmkEUsjLsMUbEG
         g/cZgTD4dot4mCZxmI1yCGrhqMFfi1F7P3f2FusfD25+YmcnYOVbcQBTaB4DjfmevI2v
         +0ByFl6j8qTq57T3ChiSr5SOzYp2YwXVc1zeyODdyG13OACzmMVGqDqVwlTrPV9aH6PV
         ll7A==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:in-reply-to:references:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=WI4HivGObErvRa8J5qjt+FxFsHXo5qngIlo4ccw5W4o=;
        b=nmKGDmKTbrPH64Wqn4ZaZ/4xlMzZvzS6/vwpHOraFr4zjZG23B8E8C7n9OrTqYkPvM
         clgq4ltuiHCbyljHq7OTUCYs6T5iIuKjlV22hUulqfRgz3bQjSWtswUztuQoAweyDMXF
         FyN0qCqxS9xmBKhEvh5VzJqC8LDCExf/4VOQpFxUT+svCE9THm9AjZCQflE+I1ui3NVe
         EBCnjL7bhejV34vdfUC1IhgyxZZxacZKWrbaDuSqKLgYQzHce7CDlS9v36xhFn/DZhwZ
         kmVUpQPc8eKUsgt+H01KrfwuQTB08Rb9CkZvQqd1jo6jdCwGyquYgrKkFzNcFHTsWyNP
         kh6A==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=APXBhk6Y;
       spf=pass (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=hodges.r@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:references:in-reply-to:from:date:message-id:subject: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;
        bh=WI4HivGObErvRa8J5qjt+FxFsHXo5qngIlo4ccw5W4o=;
        b=hVqu3sbgNWkcmrO4Uy6sAZT9MeCmbwJSfGVGwUV2PGEFMqK4HHxl9JprPkxCge991B
         tS5YLKs0fYMuYQIfPxaNvPjs4BTUgFE/fEqhwryqg3SrhX3Ptt1fUAOJGnNzTQc9IXiE
         6vd7DBql9lMzw1EGjiMyn3v3wIq8+HhUaNthZRPSWEfS6BJe1S2ZPcK3HjVUJvGBAh4n
         hmbbQ4FqXskZ+fV7IzR09dT9ZRcBkpzphrzK+P4723YI4IobunofRAUrnoSq2UtwJVTO
         UHHANkfcSN0jJPN/0wxZPc6enBQ6DVIHcgdSu/fEuiymZO4aCUH7CmTBwrq/lB1Jz3rE
         eNKA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=WI4HivGObErvRa8J5qjt+FxFsHXo5qngIlo4ccw5W4o=;
        b=CCm1xXFvfOBq85VVY4IhxOu2+JTrNrXvijI4jLvslq5uQtxJEy80FwXYjWZaW9bc0x
         esCR+LjY67vvK0udNz+adpkwYwnHUmBDIDWh147YX84iWuaQgHbW7/hIWpHEJUnXMaVF
         MGT+KsvrPjwOMfDfLjcRTscKPqQ18t+K1yjM1iWpS1XU2wpuOHaytoE6TTnLg/8nyoOy
         Z3fa8f1t/A1nCjs6k3pucjbszCLRZKuuTy5wkJcOg/GHoqqPrHBcaHYnxiYbbKtUWqQA
         +/Mpnj2esRD0wGTE2ygi0ECc4E1wNM541FYLiJc5PL3VjUcCcUEba3sfC6kbTADoiR8V
         bJ8w==
X-Gm-Message-State: APt69E1EUvnNOaRshja7QM/h80pxdEqqvkxPxWL78tLkMZj7NPM7YCC7
	JU4RDl4uvCvFifvtfIpalEd0gA==
X-Google-Smtp-Source: AAOMgpeBMKPRyOR67dPiuP/eXT8p9H6CA1mPD/8egnEfRdUY/q6QUDpuxBpOQHHoY/7gzb5WJmoa+A==
X-Received: by 2002:a02:b5d1:: with SMTP id y17-v6mr3182620jaj.4.1531206403067;
        Tue, 10 Jul 2018 00:06:43 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a24:1a82:: with SMTP id 124-v6ls2304570iti.9.gmail; Tue, 10
 Jul 2018 00:06:42 -0700 (PDT)
X-Received: by 2002:a24:70b:: with SMTP id f11-v6mr19104726itf.137.1531206402012;
        Tue, 10 Jul 2018 00:06:42 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1531206401; cv=none;
        d=google.com; s=arc-20160816;
        b=zvvLZeoRYZ4c5gc3M0TPtqnSrdyZBN6EqZcYcQfJzEupBRXQKPltyH2FRUugu6y05r
         SyFdo9gkmr7lehslczad81xGENlQbqOw6PbNtOM8h06LoyVMZT4P6kHZ1+sBfNckdxVG
         gXlx7aSR8kR/g3bAfe8Dt7Y+LsjgKoGm/GXEPbLjsjp7qC64o1UwbK9otOC3OKdWXs6k
         BrwYzzgMx7hn06Ld8kSdB+bchO6I3TlSmmGebT49Wdf8tnkZuGdb4vOyE6plVVm+9TjE
         KvbynLbj6E2hh35TLvkrI6+5IfAOsppueLsIOyVebfsuIMif4VTkO6y8xag+k11QmHhJ
         Istw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:in-reply-to:references:mime-version
         :dkim-signature:arc-authentication-results;
        bh=RX0ER6pADA6Qef6a1MP1ZbkSlQ0fODfxXzMG8Tzbsgs=;
        b=boSoa1xzKLQniz+0h+1wUSvevueSvoh+5NQ17sxs/21yOtFRRxhX+9+0dURZRNINYS
         pnn08STyw58PEvoHJlSXk9yJ0nXzqJEzCqPbB1e3jcAYGxxM09B0YcXTePRC9h7uw0Nb
         fxt/PSPmpTxMhIqKnU8yP7c3cRdRZCja6WAItrXNFQfpQZadUiq1eA6aqiME9Pe789lu
         oFkgNbtMhsbH+CL7Xf28H7e0moCRmknvwYeOnnZgptRvTPTk1XX3CrTkDGpRyHh93mxn
         peqv7JPD1Q9hMu49TqbJXBmNP56w+azFy1i+XNYUKKmF9z+pKXOcaBPR8fj4oI4CQa49
         pPZg==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=APXBhk6Y;
       spf=pass (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=hodges.r@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id z145-v6sor6142783itc.92.2018.07.10.00.06.41
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Tue, 10 Jul 2018 00:06:41 -0700 (PDT)
Received-SPF: pass (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:a24:c2c2:: with SMTP id i185-v6mr3036123itg.76.1531206401468;
 Tue, 10 Jul 2018 00:06:41 -0700 (PDT)
In-Reply-To: <f377a21c-926e-4cd8-9c25-5c36b7a7a62c@isocpp.org>
X-Original-Sender: hodges.r@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=APXBhk6Y;       spf=pass
 (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=hodges.r@gmail.com;       dmarc=pass (p=NONE
 sp=QUARANTINE 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-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:39050
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/39050>

--000000000000a32dcb05709fc596
Content-Type: text/plain; charset="UTF-8"

On Tue, 10 Jul 2018 at 02:04, <gmisocpp@gmail.com> wrote:

> Hello everyone
>
> Have the authors of p10731r.html considered if this suggestion:
>
> constexpr(true) int sqr(int n) {
>   return n*n;
> }
>
> is preferable and more consistent or flexible than this which they
> currently propose:
>
> constexpr! int sqr(int n) {
>   return n*n;
> }
>
> And would it offer the following possibility and would it be useful?:
>
> constexpr(some_condition()) int sqr(int n) { // constexpr this function on
> certain conditions.
>   return n*n;
> }
>
> Also many compilers support forceinline functionality etc. Perhaps this
> should be standardized too now?
> Therefore I think the authors might want to propose this too:
>
> inline(false) int sqr(int n) { // force inline. Or inline! if the
> committee thinks best.
>   return n*n;
> }
>
> Which might similarly allow this?:
> inline(some_other_condiition()) int sqr(int n) { // force inline. Or
> inline! if the committee thinks best.
>   return n*n;
> }
>
> where some_other_condition might test for a certain platform or compile
> where forcing inline or not might be desirable despite what the compiler
> thinks.
>
> It seems to me using ! is a little unusual syntax and be less consistent
> and flexible than what I'm proposing but I admit ! is shorter.
>
> I see such macros regarding forceinline in various code bases such as
> libcxx's __config file. So perhaps forceinline's time has come too.
>
> What do the authors of p1073r1 and others think?
>

What one of the others thinks:

a) The exclamation mark on the end is revolting, adding nothing to the
syntax.

b) Do you have a compelling, motivating use case in mind? By this I mean a
real one, not just "we ought to have it because it seems consistent".

I ask for b) because I am strongly of the view that code should express
intent, which the compiler then turns into action. What is the "intent" of
writing:

constexpr(some_test()) int sqr(int n);

?

What could some_test() possibly be testing? Why would it matter? The
implementation of sqr is either a constexpr expression or it's not. If it
is, its constexpr-ness can be undone by the context of its use (because it
takes an argument). What's wrong with that?




>
> Thanks
> Show trimmed content
> Click here to Reply
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f377a21c-926e-4cd8-9c25-5c36b7a7a62c%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f377a21c-926e-4cd8-9c25-5c36b7a7a62c%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hZ8bNfWMYvzty1Dzh6OXs029k5t-nr1m1nP9uCgisA21Q%40mail.gmail.com.

--000000000000a32dcb05709fc596
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue=
, 10 Jul 2018 at 02:04, &lt;<a href=3D"mailto:gmisocpp@gmail.com">gmisocpp@=
gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><div style=3D"max-height:10000px"><div dir=3D"ltr"><div>Hello ever=
yone</div><div><br>Have the authors of=C2=A0p10731r.html considered if this=
 suggestion:</div><div><br></div><p>constexpr(true) int sqr(int n) {<br>=C2=
=A0 return n*n;<br>}</p><div><br></div><div>is preferable and more consiste=
nt or flexible than this which=C2=A0they currently propose:</div><div><br><=
/div><div>constexpr! int sqr(int n) {<br>=C2=A0 return n*n;<br>}</div><div>=
<br></div><div>And would=C2=A0it offer=C2=A0the following=C2=A0possibility =
and would it be useful?:</div><div><br></div><div>constexpr(some_condition(=
)) int sqr(int n) { //=C2=A0constexpr this function=C2=A0on certain=C2=A0co=
nditions.<br>=C2=A0 return n*n;<br>}</div><div><br>Also=C2=A0many compilers=
 support=C2=A0forceinline functionality etc. Perhaps this should be standar=
dized too now?</div><div>Therefore I think the authors might want to=C2=A0p=
ropose this too:</div><div><br></div><div>inline(false) int sqr(int n) { //=
 force inline. Or inline! if the committee thinks best.<br>=C2=A0 return n*=
n;<br>}</div><div><br></div><div>Which might similarly allow this?:</div><d=
iv>inline(some_other_condiition()) int sqr(int n) { // force inline. Or inl=
ine! if the committee thinks best.<br>=C2=A0 return n*n;<br>}</div><div><br=
></div><div>where some_other_condition might=C2=A0test for a certain platfo=
rm or compile where forcing inline or not might be desirable despite what t=
he compiler thinks.</div><div><br></div><div>It seems to me using ! is a li=
ttle unusual syntax=C2=A0and be less consistent and flexible than what I&#3=
9;m proposing but=C2=A0I admit ! is shorter.</div><div><div><br></div><div>=
I see such macros regarding forceinline in various code bases such as libcx=
x&#39;s __config file. So perhaps forceinline&#39;s time has come too.</div=
></div><div><br></div><div>What do the authors of=C2=A0p1073r1 and others t=
hink?</div></div></div></div></blockquote><div><br></div><div>What one of t=
he others thinks:</div><div><br></div><div>a) The exclamation mark on the e=
nd is revolting, adding nothing to the syntax.</div><div><br></div><div>b) =
Do you have a compelling, motivating use case in mind? By this I mean a rea=
l one, not just &quot;we ought to have it because it seems consistent&quot;=
..</div><div><br></div><div>I ask for b) because I am strongly of the view t=
hat code should express intent, which the compiler then turns into action. =
What is the &quot;intent&quot; of writing:</div><div><br></div><div><font f=
ace=3D"monospace, monospace">constexpr(some_test()) int sqr(int n);</font>=
=C2=A0</div><div><br></div><div>?</div><div><br></div><div>What could some_=
test() possibly be testing? Why would it matter? The implementation of sqr =
is either a constexpr expression or it&#39;s not. If it is, its constexpr-n=
ess can be undone by the context of its use (because it takes an argument).=
 What&#39;s wrong with that?</div><div><br></div><div>=C2=A0</div><div>=C2=
=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div style=3D"max-=
height:10000px"><div dir=3D"ltr"><div><br></div><div>Thanks<br></div></div>=
</div><a class=3D"m_3103454968196976081gwt-Anchor" style=3D"display:none">S=
how trimmed content</a> <div class=3D"m_3103454968196976081F0XO1GC-nb-P" st=
yle=3D"display:none"><div></div></div><div></div><div></div><div style=3D"d=
isplay:none"></div><div style=3D"display:none"></div><div><div class=3D"m_3=
103454968196976081F0XO1GC-ed-a"></div></div><div class=3D"m_310345496819697=
6081F0XO1GC-nb-b"><div class=3D"m_3103454968196976081F0XO1GC-nb-a m_3103454=
968196976081F0XO1GC-nb-cb"><div><div style=3D"display:inline-block"><div st=
yle=3D"display:none"></div></div> <div class=3D"m_3103454968196976081F0XO1G=
C-md-a"><div class=3D"m_3103454968196976081F0XO1GC-md-b" id=3D"m_3103454968=
196976081q_reply">Click here to <span class=3D"m_3103454968196976081F0XO1GC=
-md-c">Reply</span></div></div></div></div></div></div>

<p></p>

-- <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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f377a21c-926e-4cd8-9c25-5c36b7a7a62c%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f377a21c-926e-=
4cd8-9c25-5c36b7a7a62c%40isocpp.org</a>.<br>
</blockquote></div></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CALvx3hZ8bNfWMYvzty1Dzh6OXs029k5t-nr1=
m1nP9uCgisA21Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hZ8bNfWMYvz=
ty1Dzh6OXs029k5t-nr1m1nP9uCgisA21Q%40mail.gmail.com</a>.<br />

--000000000000a32dcb05709fc596--

.
