220 39520 <CALmDwq0skNY43NToFiQwKpvTwUSv0XWuSuRA1yEFq-A5MreK1w@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicolas Lesser <blitzrakete@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: constexpr! or constexpr(true)
Date: Fri, 3 Aug 2018 07:47:30 -0700
Lines: 175
Approved: news@gmane.org
Message-ID: <CALmDwq0skNY43NToFiQwKpvTwUSv0XWuSuRA1yEFq-A5MreK1w@mail.gmail.com>
References: <f377a21c-926e-4cd8-9c25-5c36b7a7a62c@isocpp.org> <1c719172-4ea9-4cfc-b491-d1c7da7ccaac@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="000000000000e917ed05728902ad"
X-Trace: blaine.gmane.org 1533307549 2781 195.159.176.226 (3 Aug 2018 14:45:49 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 3 Aug 2018 14:45:49 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDXKNLEUTADRBFOWSHNQKGQEOCWPXIY@isocpp.org Fri Aug 03 16:45:45 2018
Return-path: <std-proposals+bncBDXKNLEUTADRBFOWSHNQKGQEOCWPXIY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f71.google.com ([209.85.218.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDXKNLEUTADRBFOWSHNQKGQEOCWPXIY@isocpp.org>)
	id 1flbKm-0000Zo-05
	for gclcip-std-proposals@m.gmane.org; Fri, 03 Aug 2018 16:45:40 +0200
Original-Received: by mail-oi0-f71.google.com with SMTP id w128-v6sf4836569oiw.14
        for <gclcip-std-proposals@m.gmane.org>; Fri, 03 Aug 2018 07:47:51 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1533307670; cv=pass;
        d=google.com; s=arc-20160816;
        b=pnfQd10QuIF0+ZDC6/c6PNc2sd7sMjdPTK02RgC/3SLdKCElH+NO4X6WF26E35NeLZ
         deHPz6WzC4RwXzmU5JPgVdPWMo/xdqvxXWpV5fNUDVxj53gfJ+tw6LiF1q6APl2vzr9y
         DqYfr9t994mYG57yw+DshseoZKunQdqsdWjyzPML7cyTBYqjCuGvrkjiFw6OnScv18r2
         uJ+LSQT/nUF6ScjkJ2biQEi2M/KnBc9xZT/vA8xZ68TFOGQJGwPn7MFZKeb+BZUVfPbM
         3ig2mzbkEQgHHoZJ4m0QR0tJvZJBmWrVGmEvlWbHiuZZk1QalR0N7Yh/LakXli+nlrct
         nVOw==
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=EHOXapjp0lwVyQo+zHMMEJID17g4oYefGHcD43EDQYk=;
        b=kWDOJcrflr1P4BEPBn2MKPsiv5vdv6Fz8yChAu0E0OoeOVJ4VZkFtARLlSi0kZUKoG
         m0jEfcJrTR/bYUg2wkrpot65WK+IjhV8Lvtt+0zLJCwvHkCU3ShQ7JqArV/KAz1kH4az
         UlDTl1uOvWgrwLR3Z6KCDE6YWBF9OEe10rIZKUSwPA9XP3yVpZiGdOMCq3Tyvh4Lvrnu
         y5FSIxltump6gtCycgY+HHTN17YM2DgRJUOq+k/SijpWBR7Es1enkb1GyoCeiC3k5tN/
         StXH9MgJj/vk33sdO7LnbET4w2mDF0NH+Qh94GJxRAO62k9rUnpJwhwXB1WBpr5kHqEi
         NFJA==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=bUzdyHpT;
       spf=pass (google.com: domain of blitzrakete@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=blitzrakete@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=EHOXapjp0lwVyQo+zHMMEJID17g4oYefGHcD43EDQYk=;
        b=wX6SI1gp4J2fU/i1+/5D4eJBytsBO+Ox+O8RPMzctyCwbVM8Jg3549HF9GFGqtPePP
         R7KK4ixf75UMqZKTxWzLllRGUtXZpyJzskzRgclIG2JTAQByz5l8y4pDJd14Y+bxQ5pV
         YCVUE7XQnmxBtV6jEM1G7dUNh35swTw/OBWP6ro0G7N97tutdzNuix3FUvfzbNv2bh88
         d/HIAP6te5ILv7ci7szsNiQqt37TmqsZml3wENp8zPXChiUywR0toFm2SUrvNvwPoPZ1
         e4vkFnuveKODJ2+5fgLbJlyAHzx1XrDE22FnivU+dKQCZ2KghnBXR5EbJshdo7HrJc7e
         8PAg==
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=EHOXapjp0lwVyQo+zHMMEJID17g4oYefGHcD43EDQYk=;
        b=M2c3cO5m4g8Tc9BI/bvDeiLYDB3AUyY8i9+clp40kPWieIrEH8ZppP4agLxKKd+2kh
         FBak3qxv4EObp1Jh7zinPRggxwlDTMu98Iargw8HxPQfIzWTdD9fmJtgk9u/j6C8dk4Q
         3NgMvWZbkdegRE6TFfTVawYp9F/ugnn4xccm4LTrQlVrgftewUpWbRH6Rm2CRNXswfFI
         PqXGxrBawbPRXkG+WeH2erzsOod0EWP0PJ+8+ZZgzRPqK/QZqdzG28SrDkCKJHCkGnGK
         kUp4w7gDqCQnVxAedIfFh2/YM9lLpRmApEsGXoBrJRYJzjjg8L28BjelzN7AL7pSoUU/
         bQWA==
X-Gm-Message-State: AOUpUlGBJ2gqyLdXgqEkf+PfJX34Vzzf8YWVrZsH+mJMwI7kU/jTao5W
	Cd6YBIbNSw/B0/p1E/rPzWQp/w==
X-Google-Smtp-Source: AAOMgpddeYlTG/4vCKBA6syX8DJfdHG4DmzjaIKhyUYyALwY0Y2MGWrDXKRVTfFvP1GYrr5WMAOEAg==
X-Received: by 2002:aca:bcd5:: with SMTP id m204-v6mr4463281oif.101.1533307670455;
        Fri, 03 Aug 2018 07:47:50 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:aca:389:: with SMTP id 131-v6ls1054607oid.22.gmail; Fri, 03
 Aug 2018 07:47:49 -0700 (PDT)
X-Received: by 2002:aca:3d4:: with SMTP id 203-v6mr3201838oid.321.1533307669147;
        Fri, 03 Aug 2018 07:47:49 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1533307669; cv=none;
        d=google.com; s=arc-20160816;
        b=xG8WzRFvSDETx7L1XrM1TBNkRXtnCrk0wWE0cOBIL+c1fw3weB/txjRWLJml3iWMx1
         3nPaZMAf+NqfSwDInB/fh1gjE35qCiieqKI/Ctfl5q2j1b1Npfaz1ztH+efnyuiZBfnp
         PVYDXHDdtN2FSfAx2OP2rmSRm5og/piPPHGeK7TfT3IaidYUyLnnFqkhFvx7dq9h/ohS
         BijOiy/OAhod672qo+sr6X7ow8UV0srbTjE6Cs2X+OpbMxQm05uhzN3tZK+z0gYWBaeD
         PR3cAWubCzAR72R+IYqkRbI/xB6FWlkoiQQtBBAZd5NGEKF43Rg79W/wgMAncND8dph3
         8vfw==
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=ulaXSp0l6186y95AsFU8elJ02A5jUqB0Shp9ydsFzhw=;
        b=0pxFlwBKipbsQVbUAI25UZCBD4YMzwLEz/sylK/QVrqb4qpaUuscKH7HqHVCZUU0kX
         jVxWGx3Ex9YJMeWuR1i0boFSvBzEQZDIFfidO+dtxSt55mcM8i9TnLrNbRk/hm8TswcP
         nNuVN73BAfp7u7zXY5NhyFgIMx8azkbdqo4a8AIpu3BT+7kRk5+Y1jXMZb/lH0SKeIsv
         3R3MbhnNefO1fzT90waV2KFGT+07pgpdYDYOvHEuY7Jw4MqwvU442IY7E8DfsxmUyOiA
         28fpkAC8luVfP6sQmavGzsDH5HrgaT/CxrlaTprNOG/LFJb8r94ihGxEOi08F9tYPKms
         bOhg==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=bUzdyHpT;
       spf=pass (google.com: domain of blitzrakete@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=blitzrakete@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 p206-v6sor2678859oif.246.2018.08.03.07.47.49
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Fri, 03 Aug 2018 07:47:49 -0700 (PDT)
Received-SPF: pass (google.com: domain of blitzrakete@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:aca:dbc2:: with SMTP id s185-v6mr3236280oig.251.1533307668468;
 Fri, 03 Aug 2018 07:47:48 -0700 (PDT)
In-Reply-To: <1c719172-4ea9-4cfc-b491-d1c7da7ccaac@isocpp.org>
X-Original-Sender: blitzrakete@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=bUzdyHpT;       spf=pass
 (google.com: domain of blitzrakete@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=blitzrakete@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:39520
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/39520>

--000000000000e917ed05728902ad
Content-Type: text/plain; charset="UTF-8"

Why would one need to have a function that is conditionally constexpr!?

On Thu, Aug 2, 2018 at 11:19 PM <chatham130@gmail.com> wrote:

> The constexpr will need to go after the parameters, so that it can express
> a condition that is dependent on the actual value of the parameters. An
> example is to control recursion. Perhaps:
>
> auto factorial(int n)->int constexpr(n<100) {
>    if(n==0) return 1;
>    else return n*factorial(n-1);
> }
>
> On Monday, July 9, 2018 at 8:04:11 PM UTC-4, gmis...@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?
>>
>> 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/1c719172-4ea9-4cfc-b491-d1c7da7ccaac%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/1c719172-4ea9-4cfc-b491-d1c7da7ccaac%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/CALmDwq0skNY43NToFiQwKpvTwUSv0XWuSuRA1yEFq-A5MreK1w%40mail.gmail.com.

--000000000000e917ed05728902ad
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Why would one need to have a function that is conditionall=
y constexpr!?</div><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Thu, =
Aug 2, 2018 at 11:19 PM &lt;<a href=3D"mailto:chatham130@gmail.com">chatham=
130@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div d=
ir=3D"ltr">The constexpr will need to go after the parameters, so that it c=
an express a condition that is dependent on the actual value of the paramet=
ers. An example is to control recursion. Perhaps:<div><br></div><div>auto f=
actorial(int n)-&gt;int constexpr(n&lt;100) {</div><div>=C2=A0 =C2=A0if(n=
=3D=3D0) return 1;</div><div>=C2=A0 =C2=A0else return n*factorial(n-1);<br>=
}<br><div><div><br></div><div>On Monday, July 9, 2018 at 8:04:11 PM UTC-4, =
<a href=3D"mailto:gmis...@gmail.com" target=3D"_blank">gmis...@gmail.com</a=
> wrote:<br></div><div><blockquote class=3D"gmail_quote" style=3D"margin:0;=
margin-left: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 everyone=
</div><div><br>Have the authors of=C2=A0p10731r.html considered if this sug=
gestion:</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 consistent o=
r 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()) i=
nt sqr(int n) { //=C2=A0constexpr this function=C2=A0on certain=C2=A0condit=
ions.<br>=C2=A0 return n*n;<br>}</div><div><br>Also=C2=A0many compilers sup=
port=C2=A0forceinline functionality etc. Perhaps this should be standardize=
d too now?</div><div>Therefore I think the authors might want to=C2=A0propo=
se this too:</div><div><br></div><div>inline(false) int sqr(int n) { // for=
ce inline. Or inline! if the committee thinks best.<br>=C2=A0 return n*n;<b=
r>}</div><div><br></div><div>Which might similarly allow this?:</div><div>i=
nline(some_other_condiition()) int sqr(int n) { // force inline. Or inline!=
 if the committee thinks best.<br>=C2=A0 return n*n;<br>}</div><div><br></d=
iv><div>where some_other_condition might=C2=A0test for a certain platform o=
r compile where forcing inline or not might be desirable despite what the c=
ompiler thinks.</div><div><br></div><div>It seems to me using ! is a little=
 unusual syntax=C2=A0and be less consistent and flexible than what I&#39;m =
proposing but=C2=A0I admit ! is shorter.</div><div><div><br></div><div>I se=
e such macros regarding forceinline in various code bases such as libcxx&#3=
9;s __config file. So perhaps forceinline&#39;s time has come too.</div></d=
iv><div><br></div><div>What do the authors of=C2=A0p1073r1 and others think=
?</div><div><br></div><div>Thanks<br></div></div></div><a style=3D"display:=
none">Show trimmed content</a> <div style=3D"display:none"><div></div></div=
><div></div><div></div><div style=3D"display:none"></div><div style=3D"disp=
lay:none"></div><div><div></div></div><div><div><div><div style=3D"display:=
inline-block"><div style=3D"display:none"></div></div> <div><div>Click here=
 to <span>Reply</span></div></div></div></div></div></div></blockquote></di=
v></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/1c719172-4ea9-4cfc-b491-d1c7da7ccaac%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/1c719172-4ea9-=
4cfc-b491-d1c7da7ccaac%40isocpp.org</a>.<br>
</blockquote></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/CALmDwq0skNY43NToFiQwKpvTwUSv0XWuSuRA=
1yEFq-A5MreK1w%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmDwq0skNY43NTo=
FiQwKpvTwUSv0XWuSuRA1yEFq-A5MreK1w%40mail.gmail.com</a>.<br />

--000000000000e917ed05728902ad--

.
