220 37293 <CALmDwq1SROgxcm8=7q2WaC=F4-cfkUycvEC6oCroEna-KFDZ8Q@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: Pointer overload for ||
Date: Sun, 11 Mar 2018 11:00:38 +0100
Lines: 131
Approved: news@gmane.org
Message-ID: <CALmDwq1SROgxcm8=7q2WaC=F4-cfkUycvEC6oCroEna-KFDZ8Q@mail.gmail.com>
References: <1fea07df-46a6-4df2-865a-849be8f8d129@isocpp.org>
 <CAANG=kVsGNaXGZLtbNm=9cJxjLXwu0cgL=p_kYa1TCRSKfNCvg@mail.gmail.com>
 <CAANG=kUmThSamFisncxMCaqFd6Ze7GWH-q+TjMn4YfFTn2T8+w@mail.gmail.com>
 <CALmDwq3powZ_ytSPztv=Zz-TryE1jcDwDsDhtoABggvcFeJK+g@mail.gmail.com> <05da71c2-80cf-63dd-b2c6-8cd342db5140@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="089e08e5c2e9f08919056720183d"
X-Trace: blaine.gmane.org 1520762319 30364 195.159.176.226 (11 Mar 2018 09:58:39 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 11 Mar 2018 09:58:39 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDXKNLEUTADRBR74SPKQKGQEW747PHY@isocpp.org Sun Mar 11 10:58:35 2018
Return-path: <std-proposals+bncBDXKNLEUTADRBR74SPKQKGQEW747PHY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f70.google.com ([209.85.218.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDXKNLEUTADRBR74SPKQKGQEW747PHY@isocpp.org>)
	id 1euxkQ-0007mo-CY
	for gclcip-std-proposals@m.gmane.org; Sun, 11 Mar 2018 10:58:34 +0100
Original-Received: by mail-oi0-f70.google.com with SMTP id u68sf7034753oia.0
        for <gclcip-std-proposals@m.gmane.org>; Sun, 11 Mar 2018 03:00:41 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1520762440; cv=pass;
        d=google.com; s=arc-20160816;
        b=tpa4onCkOehlenUcp5ewJybm3kSsfH+vSGnJFgU9QheQQ1KNkNyjhEkN2H8P4ji52S
         zgP6CPwdH3HHjCuALLSIW/8J+xFUMaekaXsi/a1eWv8vqhtt41HwsgvpyypzXK/3FCx7
         JhY3mbPGZMbfqBN+rMxdWPwHkmfSVLnoc0clTb/prnQFvkRw9XuvkgmpSp7N9YDOk8U9
         Kiy6gjFEU7pfDa6SPE8aUsofq1C7iwdbTQd+8r0QKAQo8CjWDF4acOQIfSgNRGvZ1jl/
         qAgLy91jQ4SVv9y93nSiyG8igD8xbr9jpbSRYlEWSKZNfCkOzOXoFwC0rWIysNDblIJ3
         YQYQ==
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:references:in-reply-to:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=fuHztuaGciQhF0YWX+mbYiPAvm6jcxBIGFc0N6QBg1g=;
        b=nKbIam4krpZB6WVCI11JuRg2/Zy86mFM3LOmYYVQBifHqKu1DSGlzENMukWbNJJ+GS
         ZELxH2KYIspJXv58NUI3bjqLxNUDFy02OtOMyFLNeDpffWY+HbBluNCGLy62cS5chlhc
         hAX6LhkgqKXekXpOddD3YuxwFu+zOJGut0FZJ19Pi/x5HhN1fMLLBVmGrFlAKoAR7Qbc
         aNUP3UG24tofrZRf6cnx1wAbLqbZqfF9lLgB2FzUtlfGMWDIpPZ21j3hSQQdsB08YznR
         46AC44t6IhO8fX+vPrPolsG3DaDeZpJABq1YQDAMrdsMvMf78FElE0syziA7VakC81+H
         qEbw==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=ogR4gWjo;
       spf=pass (google.com: domain of blitzrakete@gmail.com designates 209.85.220.65 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:in-reply-to:references: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=fuHztuaGciQhF0YWX+mbYiPAvm6jcxBIGFc0N6QBg1g=;
        b=AM82LBgFkBhnwB8HGkgkm4PfbWs4h4QNscvPQmkb/AdYo2FaGRyF3BLmVgn4kebk7i
         qzubynd6QNZNzIxWhfpka47K/bDYR++UgW7Qpz0AjZ3bAR6QZpIpXoo3+imkEC75NFOL
         ZQAG6xPelwcitO8YJU8pfswcwvD5IB0GqSE3dK797+Yk+oN1SVtPF0z6wMTwUkMJTo+I
         G3Hi0mGytkaPT7yfxpGN4fXqi8JxfeNZM4LaL/PoaV0RLyD1nyGqGxY2dSOas3zLWSQD
         muzUpMsuqnZVMdrbRFwVF0D5huJzdUXMiVWegWCj+gdEOiCTR5+UXBR9SiVtwuy2pAQa
         bIsA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references: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=fuHztuaGciQhF0YWX+mbYiPAvm6jcxBIGFc0N6QBg1g=;
        b=ii6p4L5wl7+DikFNjQtTMdw7EcW103l8IpKxPDdMRr1Uxrx8yjhMg+6CvEfaV7+s0P
         tY7hpEEsR0UyeOaQXVAgyl7OWqClvIgnd3eVw5DXnFJnH3eJk0R+RpgfDf86KgYNhEYF
         m1bo/2n4p16K6Mjo+859PVAiSAftGtH8Z9FXPpbQn4vd/SJdetBAhAyitqhgbZc9esog
         t+Ri93FScwCZ4n9T4QWubc0jHwJhoDtjLO3tFPr82+b23AuiEgB9kyHT0r/QP9YwW00L
         MaGylq9dkmf/MkQNpxEfPJAzRNlVt+bTVhmHxUx/1dGj71HirMBLIntU995rd5HQ+hDa
         mVbw==
X-Gm-Message-State: AElRT7GNC2MSBQ4B999HMEQ6t/gjkqa+NhckojH9F0lsPmOJkETeSjNQ
	OGKU1iNRvCBp5NmMZ9R/Rh1kQA==
X-Google-Smtp-Source: AG47ELtdij4grATbrXsICk3cz6VbZmN9KL5P57bWFpgViePQOgBa5vIkbVnZdToi7OnGZ4X+RJAkeA==
X-Received: by 10.157.56.173 with SMTP id p42mr2158054otc.96.1520762440690;
        Sun, 11 Mar 2018 03:00:40 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.76.7 with SMTP id l7ls6082327otf.17.gmail; Sun, 11 Mar
 2018 03:00:39 -0700 (PDT)
X-Received: by 10.157.63.228 with SMTP id i33mr2833540ote.51.1520762439600;
        Sun, 11 Mar 2018 03:00:39 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1520762439; cv=none;
        d=google.com; s=arc-20160816;
        b=T5RP/03hen49Ga0ijn2kfb3HZ8zAbIg+Mimc8ILP+89ByZEZHKJJmQvzum0IQZvT36
         YrW4iogKgrLQupkG/Fa7n+G/e+7C/tFleMvoiPr/27Lp4ljbKIJnqbKY0fOm82JppICz
         Z/lfrRFu9ER+H+MQdnzPCWhcixFx4lQR8g3AeZ3r1df6oB9T3HYpxq/nvYuk/AO8ikI6
         rrf0M2lOzTVUrJkCdFnzK1TLE64Q1MijgeEL5fYkii04EGloMG9/h169vbIJcJhOA68b
         wfTi30bUuPn38PaA469DB5Zv+prT9h6BflC97udnsPuGNOuWEszqakOyRTjctXgx1Kat
         ED1g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :dkim-signature:arc-authentication-results;
        bh=rVG/rvztTaamqH6FYPz3mvjXqyHXO5/iXvg9fkPvf9o=;
        b=K0Tm/aKroMpBolHEwIn1KlOQ/UlFFbyEsL5eo2+YLEAte8ecdC4P3P3FEF/2dI6ob7
         N7bcgx5EY6QSJ1aJ3QRQLvrpEMh7Z+OldJgZFzNYnrlWNRe7dOOIZJdPCDHe7biMwaaZ
         +yXUmn4Pn3d/54lU/NgcDwQSFy0mKLfSbxajuWn+4u7A8LT5GqHyehUI7JJMExER89z6
         MT4cyNYHPwVEWnVjZdDysyD5LfuKjn7dn82BhWD76G7MwfjWZ8MuNE8EaG6MquNMc8Om
         2CWY292iCvoB/zwShhQYm4pLjK+qkIGWNrYSigE613mpJP38jaipVcBFat/BMFAg0qjb
         O0tQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=ogR4gWjo;
       spf=pass (google.com: domain of blitzrakete@gmail.com designates 209.85.220.65 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-f65.google.com (mail-sor-f65.google.com. [209.85.220.65])
        by mx.google.com with SMTPS id h12sor1957024oti.158.2018.03.11.03.00.39
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Sun, 11 Mar 2018 03:00:39 -0700 (PDT)
Received-SPF: pass (google.com: domain of blitzrakete@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65;
X-Received: by 10.157.75.130 with SMTP id k2mr3074273otf.244.1520762438583;
 Sun, 11 Mar 2018 03:00:38 -0700 (PDT)
Original-Received: by 2002:a9d:5e01:0:0:0:0:0 with HTTP; Sun, 11 Mar 2018 03:00:38
 -0700 (PDT)
Original-Received: by 2002:a9d:5e01:0:0:0:0:0 with HTTP; Sun, 11 Mar 2018 03:00:38
 -0700 (PDT)
In-Reply-To: <05da71c2-80cf-63dd-b2c6-8cd342db5140@gmail.com>
X-Original-Sender: blitzrakete@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=ogR4gWjo;       spf=pass
 (google.com: domain of blitzrakete@gmail.com designates 209.85.220.65 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:37293
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37293>

--089e08e5c2e9f08919056720183d
Content-Type: text/plain; charset="UTF-8"

> Also that inverted logic has a high chance of confusing anyone who comes
> across it, and it some cases, it is not even clear which or operator you
> choose.
>
> var = var || allocate();
>
> If allocate doesn't return a pointer, but a boolean (or due to a refactor
> it changes) then the expression above would no longer do the right thing:
> assign 1 to var if either expression is true, which is not expected.

I don't know precisely what you mean by "inverted" logic


My bad, that's not true. I was thinking of &&.

, but I don't agree that it would necessarily confuse anyone who comes
across it - it would just be unfamiliar syntax, which they would look up.
It's true that the expression would compile regardless of whether
allocate() returns a bool or a pointer, which could cause a surprising bug
due to implicit pointer-to-bool conversion, but I don't feel like that's
very likely, or that it would be very likely that a refactor would cause a
problem there either.  Specifically if your allocate() is changed from
returning a pointer to returning a bool during a refactor, its signature
would change in other ways that would cause a compile error there, i.e.
taking a reference to the pointer to allocate as an argument instead of
returning it.


That is true, my example was pretty bad.


Jefferson Carpenter

-- 
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/is
ocpp.org/d/msgid/std-proposals/05da71c2-80cf-63dd-b2c6-
8cd342db5140%40gmail.com.

-- 
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/CALmDwq1SROgxcm8%3D7q2WaC%3DF4-cfkUycvEC6oCroEna-KFDZ8Q%40mail.gmail.com.

--089e08e5c2e9f08919056720183d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div class=3D"gmail_extra" dir=3D"auto"><div class=3D"gma=
il_quote"><br><blockquote class=3D"quote" style=3D"margin:0 0 0 .8ex;border=
-left:1px #ccc solid;padding-left:1ex"><div class=3D"quoted-text">
&gt; Also that inverted logic has a high chance of confusing anyone who com=
es<br>
&gt; across it, and it some cases, it is not even clear which or operator y=
ou<br>
&gt; choose.<br>
&gt;<br>
&gt; var =3D var || allocate();<br>
&gt;<br>
&gt; If allocate doesn&#39;t return a pointer, but a boolean (or due to a r=
efactor<br>
&gt; it changes) then the expression above would no longer do the right thi=
ng:<br>
&gt; assign 1 to var if either expression is true, which is not expected.<b=
r>
<br></div>
I don&#39;t know precisely what you mean by &quot;inverted&quot; logic</blo=
ckquote></div></div><div dir=3D"auto"><br></div><div dir=3D"auto">My bad, t=
hat&#39;s not true. I was thinking of &amp;&amp;.</div><div dir=3D"auto"><b=
r></div><div class=3D"gmail_extra" dir=3D"auto"><div class=3D"gmail_quote">=
<blockquote class=3D"quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc=
 solid;padding-left:1ex">, but I don&#39;t agree that it would necessarily =
confuse anyone who comes across it - it would just be unfamiliar syntax, wh=
ich they would look up.=C2=A0 It&#39;s true that the expression would compi=
le regardless of whether allocate() returns a bool or a pointer, which coul=
d cause a surprising bug due to implicit pointer-to-bool conversion, but I =
don&#39;t feel like that&#39;s very likely, or that it would be very likely=
 that a refactor would cause a problem there either.=C2=A0 Specifically if =
your allocate() is changed from returning a pointer to returning a bool dur=
ing a refactor, its signature would change in other ways that would cause a=
 compile error there, i.e. taking a reference to the pointer to allocate as=
 an argument instead of returning it.</blockquote></div></div><div dir=3D"a=
uto"><br></div><div dir=3D"auto">That is true, my example was pretty bad.</=
div><div dir=3D"auto"><br></div><div class=3D"gmail_extra" dir=3D"auto"><di=
v class=3D"gmail_quote"><blockquote class=3D"quote" style=3D"margin:0 0 0 .=
8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=3D"quoted-text"=
>
<br>
Jefferson Carpenter<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%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isoc<wbr>pp.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></div>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/05da71c2-80cf-63dd-b2c6-8cd342db5140%=
40gmail.com" rel=3D"noreferrer" target=3D"_blank">https://groups.google.com=
/a/is<wbr>ocpp.org/d/msgid/std-proposals<wbr>/05da71c2-80cf-63dd-b2c6-<wbr>=
8cd342db5140%40gmail.com</a>.<br>
</blockquote></div><br></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/CALmDwq1SROgxcm8%3D7q2WaC%3DF4-cfkUyc=
vEC6oCroEna-KFDZ8Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmDwq1SROgx=
cm8%3D7q2WaC%3DF4-cfkUycvEC6oCroEna-KFDZ8Q%40mail.gmail.com</a>.<br />

--089e08e5c2e9f08919056720183d--

.
