220 37291 <CALmDwq3powZ_ytSPztv=Zz-TryE1jcDwDsDhtoABggvcFeJK+g@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 10:16:56 +0100
Lines: 289
Approved: news@gmane.org
Message-ID: <CALmDwq3powZ_ytSPztv=Zz-TryE1jcDwDsDhtoABggvcFeJK+g@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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="f4f5e808dde8ad2a8c05671f7c7a"
X-Trace: blaine.gmane.org 1520759696 19769 195.159.176.226 (11 Mar 2018 09:14:56 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 11 Mar 2018 09:14:56 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDXKNLEUTADRBCPISPKQKGQE2HPQOKY@isocpp.org Sun Mar 11 10:14:52 2018
Return-path: <std-proposals+bncBDXKNLEUTADRBCPISPKQKGQE2HPQOKY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ot0-f200.google.com ([74.125.82.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDXKNLEUTADRBCPISPKQKGQE2HPQOKY@isocpp.org>)
	id 1eux47-00050y-VI
	for gclcip-std-proposals@m.gmane.org; Sun, 11 Mar 2018 10:14:52 +0100
Original-Received: by mail-ot0-f200.google.com with SMTP id v63sf7580048ota.12
        for <gclcip-std-proposals@m.gmane.org>; Sun, 11 Mar 2018 01:16:59 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1520759818; cv=pass;
        d=google.com; s=arc-20160816;
        b=bb+NGaqlIWTVXT3hgWJ2S2Ae2EoKsQmYOb5iruOI1dvaxCMUAMQDeHLwmWGmlb9KQB
         NsDUQkWZJmhNCt2Ax453IeADnJR/VzxRfop06D6b2DYHF8jp8BJuE8Z0yDrichKkfRdX
         iTin44W+k92e9hPopcmZTjjv/YPEKrZbnwFMEwD0R0od7Tt9BU7Ev5X1X4/mwfLTCWNA
         MjUmNGNkDQLbpS6AimG2KdzCOH5pIifbbt+GlgUAJ+/fdedQSyeorfqYSlFp07hxQG1a
         EnmSvqapL75CvFi8yQ72Cs0/JZe7DGhd3aQZVFqukGhGvs7MkiZ999dKT6Y2h4VoSoZR
         a4zg==
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=pIGs40UYws81yiuwPz/mPdgUMVuvy5R8vyV68+gwLTU=;
        b=PHjvdYfLluFPK0cGWOugy0asE4CdMBuwydbruwX6RosVFMAXA0TqI/32pejui6QqUN
         jmNDNmjaK9gcqXw60t95dRwLg2q3EiBXvaev4c+t/uH+hM87Hc02EbtXPFNQQ0df4i5e
         YfQNn2B7KJAwPXkS0HcSVf1D8wFW7Gq3PkkQpSSIEIP82p6KFDeVRBlfNBc7221u00Qw
         X94m6fEVGEo6u12FDcjPpdwL/+7d9MErgbD5SnkSxLE0SdKqVqkpjtgQVFuFx+xC50Xl
         fjUGsw3/CqR+9ALM3N/rbac8fTe2yjezGdzMzh5kPJe1G1YDdkhG4f+1JJ3nfiaMlyf6
         QOBQ==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=OM9VWbHE;
       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: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=pIGs40UYws81yiuwPz/mPdgUMVuvy5R8vyV68+gwLTU=;
        b=xtz8gzmwNI8QrGRSymi9EsEf2HAYOf5b9CvBqLE6xZyOH9GluTc+7hxWMfwWRkedEq
         0PF+/wJFRf0GuLmFAgbA1JR88aZZ2upaSkKxLO8Yu5KenDKqoN3Ystzi2WTrnTfU/iJM
         JhHo0S2Ckitfcb39MUS2uf90c6zAKGZ2iG4SxT5zj6MEyCfgU2iecZIrLeuK4OTbo702
         UA1Y5nFTLWEaFSxuXTfaq+CItTJL7Yd8WrB7nW4MusFDz9KqyJz0/oiMbggILyyYLhWw
         xxMHSuMyVCO4MilQCngyyWbKI/EEq/HGFCgGs1RKb88OoYEHZC2SbwePA001w9lR774p
         gU8Q==
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=pIGs40UYws81yiuwPz/mPdgUMVuvy5R8vyV68+gwLTU=;
        b=uZK4LatT3lUGiIGusDdCSZkgh8WnnbaejfyLTol9aTHRZhNBvtZ52FbGD208HeZ+on
         w7+XJluCAMR8I0CTZWubooQsNFpvqE3EVmJQ6kpw4X2TJ+glzyxKEQ+sfiE90WJl79e/
         iriD6vx+HNjYUglEGrMa0O+mYUu8NuO3D1OrtbmQJ+O83DOcOR+ErfbkJG5cC+Vpdjy/
         kGiKv9jiiQzik+NbCPs70qQlRzLI/S1ggqExD/n24EeNWP2zm+e2Z2kI5tD1MeiyBYeF
         z31f2XTc3fU3MB9BW1n4obANqJ1cN/rB3o9Kvd/1JtFo8h0PhaEkFZ1QS7hC7JjoWTw1
         T58A==
X-Gm-Message-State: AElRT7GYyRwBLy59igleV/pWNzXiVwosm2l0xJBvAlJpBR4lW1b421Dn
	WazXMXwhLmakxx2aL1t5Rj00ow==
X-Google-Smtp-Source: AG47ELvhZ5qw8xu/zZQjqU3JmFoMdtFzZ7G5nJ/wVru01/wOOIgE8KPm25m6CUnXRgoO3rCx16GaBw==
X-Received: by 10.157.81.204 with SMTP id d12mr2166382oth.59.1520759818604;
        Sun, 11 Mar 2018 01:16:58 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.202.235.143 with SMTP id j137ls49688oih.12.gmail; Sun, 11 Mar
 2018 01:16:57 -0800 (PST)
X-Received: by 10.202.186.6 with SMTP id k6mr2692864oif.169.1520759817469;
        Sun, 11 Mar 2018 01:16:57 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1520759817; cv=none;
        d=google.com; s=arc-20160816;
        b=GUlg+gC7bRT+ievrCoRrM0Ug7ZW/UNeERiN72gKP4Ekk2fODUZJ/NXkmpvB2WxaQDp
         KJz4Uch7ONPdb9HV8rTn0Tdgiuu1HWp+OATU4rmwy08CmtPwkfBCesERKbMwu+lpK4Hq
         f79hUxxsaAC/BRkQ/rSM575Wve0om25VJGOux/DZL/OAWSglKpWb+4/VfuvuLQykxPP9
         mNGI0uKE9PEzN8Ss4nqjsHPQlWoh3TChu9vxReZdXENVNceCHmOtVjXAGjkdu+a9Avlk
         49JucHPQdHf//hQOd5IFeQWkjml6y9nGkHWt0INyFBq5YRMbNzmPb2kU/e8xHdE3QuMC
         1o7Q==
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=7ra8dWjDVwH9MrO+IdpzMnE5/7FUmRXVuTcZR37DMQg=;
        b=mLlx8XvesGfDbfjSu8jH4zuiZJwiVwyuf8RB9r7JIz0GgHCiNEQvw3/SW7W8A+Haau
         OwFbu4+n2a2ANgdvUdEqBRLXOg+hHhYoNL0Iis6pXmUwfs7+J1ONPbuEgWTXknXjlCGB
         VOJedwTWrjxbayzLnJE6uubNC7NGUrYppPYS9CVgW+Bxk4xsHGSd/dw5LLNhR0bJ4RWE
         i26cDZMOhWwj5rPQetuuntBOJxDE2FEvyvVBEe9enUdveEfyPZfgFsOueDPoJR1ksGNw
         uS7AsVkGQCuRe04X8lw8xyS1RYjkJGu1CUbdyBLpqWu0//v4/ipKg4g6Mpb9/pMQln2n
         aKzg==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=OM9VWbHE;
       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 l13sor1948420oib.67.2018.03.11.01.16.57
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Sun, 11 Mar 2018 01:16:57 -0800 (PST)
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 10.202.13.8 with SMTP id 8mr2646395oin.272.1520759816922; Sun,
 11 Mar 2018 01:16:56 -0800 (PST)
Original-Received: by 2002:a9d:5e01:0:0:0:0:0 with HTTP; Sun, 11 Mar 2018 01:16:56
 -0800 (PST)
Original-Received: by 2002:a9d:5e01:0:0:0:0:0 with HTTP; Sun, 11 Mar 2018 01:16:56
 -0800 (PST)
In-Reply-To: <CAANG=kUmThSamFisncxMCaqFd6Ze7GWH-q+TjMn4YfFTn2T8+w@mail.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=OM9VWbHE;       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:37291
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37291>

--f4f5e808dde8ad2a8c05671f7c7a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I don't see the point. How is your if not succinct?

if (!ptr)
    ptr =3D new int;

is very short and understandable. More so than your idea, as that
complicates the logical or operator.

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 =3D 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.

You could take inspiration from Python or use the GNU binary op Ga=C5=A1per
mentioned:

x =3D new int if (!x);

But I don't like that either. In short, the first if version is by far the
most understandable and clear way of achieving what you want IMO.

On Mar 11, 2018 10:03 AM, "Ga=C5=A1per A=C5=BEman" <gasper.azman@gmail.com>=
 wrote:

> In my morning fog I forgot I needed to specify that it was the version of
> assert where you only evaluate the message portion if the condition faile=
d.
> Not the standard assert.
>
> On Sun, Mar 11, 2018 at 8:58 AM, Ga=C5=A1per A=C5=BEman <gasper.azman@gma=
il.com>
> wrote:
>
>> There is a binary form of the conditional operator that is a gnu
>> extension:
>>
>> void foo(int *x) {
>>   x =3D x?:new int;
>> }
>>
>> It's defined as
>>
>> CEXPR ?: FEXPR;
>>
>> and rewritten into
>>
>> {
>>    auto&& x =3D CEXPR;
>>    if (x) { return x; } else { return FEXPR; }
>> }
>>
>> Perhaps you could propose that instead, as it's far more general. It's a
>> GNU extension because certain macros (assert comes to mind) are much eas=
ier
>> to implement if you have it.
>>
>> G
>>
>>
>>
>>
>> On Sun, Mar 11, 2018, 08:38 <jeffersoncarpenter2@gmail.com> wrote:
>>
>>> Not sure how this will be received -- I haven't posted here much.  Just
>>> thought it would be worth mentioning this idea.
>>>
>>> Suppose you have an API that you want to optionally allocate storage fo=
r
>>> your user.  They can either pass in a pointer to some existing allocate=
d
>>> space, or pass in a null pointer and space is allocated for them.
>>>
>>> void foo(int *x) {
>>>   if (x =3D=3D nullptr) {
>>>     x =3D new int;
>>>   }
>>>   // etc.
>>> }
>>>
>>> Just figured it would be a decent idea if the || operator received a
>>> pointer overload.  Then you could write the more succinct
>>>
>>> void foo(int *x) {
>>>   x =3D x || new int;
>>> }
>>>
>>> or even (ducks for cover)
>>>
>>> void foo(int *x) {
>>>   x ||=3D new int;
>>> }
>>>
>>> would be nice.
>>>
>>> Currently, if I am not mistaken, || (excluding user-defined overloads)
>>> is a boolean-only operator.  It is indeed the case that nullptr is the =
only
>>> value that becomes false when cast to a boolean, and all other pointer
>>> values become true.  So I don't see how adding an || overload for point=
ers
>>> would break any existing code.
>>>
>>> The main thing that would make this a no-go would be if the semantics o=
f
>>> || required that both operands be evaluated -- whether or not the left-=
hand
>>> one is false.  Then the whole point as I see it would be lost - the abo=
ve
>>> examples would merely leak memory.
>>>
>>> - 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/1fea07df-46a6-4df2-865a-849be
>>> 8f8d129%40isocpp.org
>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/1fea07df-=
46a6-4df2-865a-849be8f8d129%40isocpp.org?utm_medium=3Demail&utm_source=3Dfo=
oter>
>>> .
>>>
>>
> --
> 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/CAANG%3DkUmThSamFisncxMCaqFd6Ze7GWH-
> q%2BTjMn4YfFTn2T8%2Bw%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkUm=
ThSamFisncxMCaqFd6Ze7GWH-q%2BTjMn4YfFTn2T8%2Bw%40mail.gmail.com?utm_medium=
=3Demail&utm_source=3Dfooter>
> .
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CALmDwq3powZ_ytSPztv%3DZz-TryE1jcDwDsDhtoABggvcF=
eJK%2Bg%40mail.gmail.com.

--f4f5e808dde8ad2a8c05671f7c7a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">I don&#39;t see the point. How is your if not succinct?<d=
iv dir=3D"auto"><br></div><div dir=3D"auto">if (!ptr)</div><div dir=3D"auto=
">=C2=A0 =C2=A0 ptr =3D new int;</div><div dir=3D"auto"><br></div><div dir=
=3D"auto">is very short and understandable. More so than your idea, as that=
 complicates the logical or operator.</div><div dir=3D"auto"><br></div><div=
 dir=3D"auto">Also that inverted logic has a high chance of confusing anyon=
e who comes across it, and it some cases, it is not even clear which or ope=
rator you choose.</div><div dir=3D"auto"><br></div><div dir=3D"auto">var =
=3D var || allocate();</div><div dir=3D"auto"><br></div><div dir=3D"auto">I=
f allocate doesn&#39;t return a pointer, but a boolean (or due to a refacto=
r 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.</div>=
<div dir=3D"auto"><br></div><div dir=3D"auto">You could take inspiration fr=
om Python or use the GNU binary op Ga=C5=A1per mentioned:</div><div dir=3D"=
auto"><br></div><div dir=3D"auto">x =3D new int if (!x);</div><div dir=3D"a=
uto"><br></div><div dir=3D"auto">But I don&#39;t like that either. In short=
, the first if version is by far the most understandable and clear way of a=
chieving what you want IMO.</div></div><div class=3D"gmail_extra"><br><div =
class=3D"gmail_quote">On Mar 11, 2018 10:03 AM, &quot;Ga=C5=A1per A=C5=BEma=
n&quot; &lt;<a href=3D"mailto:gasper.azman@gmail.com" target=3D"_blank">gas=
per.azman@gmail.com</a>&gt; wrote:<br type=3D"attribution"><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><div dir=3D"ltr">In my morning fog I forgot I needed to spec=
ify that it was the version of assert where you only evaluate the message p=
ortion if the condition failed. Not the standard assert.</div><div class=3D=
"gmail_extra"><br><div class=3D"gmail_quote">On Sun, Mar 11, 2018 at 8:58 A=
M, Ga=C5=A1per A=C5=BEman <span dir=3D"ltr">&lt;<a href=3D"mailto:gasper.az=
man@gmail.com" target=3D"_blank">gasper.azman@gmail.com</a>&gt;</span> wrot=
e:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div dir=3D"auto"><di=
v>There is a binary form of the conditional operator that is a gnu extensio=
n:</div><div><br></div><div>void foo(int *x) {</div><div>=C2=A0 x =3D x?:ne=
w int;</div><div>}</div><div><br></div><div>It&#39;s defined as</div><div><=
br></div><div>CEXPR ?: FEXPR;</div><div><br></div><div>and rewritten into</=
div><div><br></div><div>{</div><div>=C2=A0 =C2=A0auto&amp;&amp; x =3D CEXPR=
;</div><div>=C2=A0 =C2=A0if (x) { return x; } else { return FEXPR; }</div><=
div>}</div><div><br></div><div>Perhaps you could propose that instead, as i=
t&#39;s far more general. It&#39;s a GNU extension because certain macros (=
assert comes to mind) are much easier to implement if you have it.</div><sp=
an class=3D"m_4872259237021468760HOEnZb"><font color=3D"#888888"><div><br><=
/div><div>G</div></font></span><div><div class=3D"m_4872259237021468760h5">=
<div><div dir=3D"auto"><br></div><div dir=3D"auto"><br></div><br><br><div c=
lass=3D"gmail_quote"><div dir=3D"ltr">On Sun, Mar 11, 2018, 08:38  &lt;<a h=
ref=3D"mailto:jeffersoncarpenter2@gmail.com" target=3D"_blank">jeffersoncar=
penter2@gmail.com</a><wbr>&gt; wrote:<br></div><blockquote class=3D"gmail_q=
uote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1e=
x"><div dir=3D"ltr">Not sure how this will be received -- I haven&#39;t pos=
ted here much.=C2=A0 Just thought it would be worth mentioning this idea.<b=
r><br>Suppose you have an API that you want to optionally allocate storage =
for your user.=C2=A0 They can either pass in a pointer to some existing all=
ocated space, or pass in a null pointer and space is allocated for them.<br=
><br>void foo(int *x) {<br>=C2=A0 if (x =3D=3D nullptr) {<br>=C2=A0=C2=A0=
=C2=A0 x =3D new int;<br>=C2=A0 }<br>=C2=A0 // etc.<br>}<br><br>Just figure=
d it would be a decent idea if the || operator received a pointer overload.=
=C2=A0 Then you could write the more succinct<br><br>void foo(int *x) {<br>=
=C2=A0 x =3D x || new int;<br>}<br><br>or even (ducks for cover)<br><br>voi=
d foo(int *x) {<br>=C2=A0 x ||=3D new int;<br>}<br><br>would be nice.<br><b=
r>Currently, if I am not mistaken, || (excluding user-defined overloads) is=
 a boolean-only operator.=C2=A0 It is indeed the case that nullptr is the o=
nly value that becomes false when cast to a boolean, and all other pointer =
values become true.=C2=A0 So I don&#39;t see how adding an || overload for =
pointers would break any existing code.<br><br>The main thing that would ma=
ke this a no-go would be if the semantics of || required that both operands=
 be evaluated -- whether or not the left-hand one is false.=C2=A0 Then the =
whole point as I see it would be lost - the above examples would merely lea=
k memory.<br><br>- Jefferson Carpenter<br></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" rel=3D"nore=
ferrer" 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" rel=3D"noreferrer" 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/1fea07df-46a6-4df2-865a-849be8f8d129%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" rel=3D"noreferrer"=
 target=3D"_blank">https://groups.google.com/a/is<wbr>ocpp.org/d/msgid/std-=
proposals<wbr>/1fea07df-46a6-4df2-865a-849be<wbr>8f8d129%40isocpp.org</a>.<=
br>
</blockquote></div></div></div></div></div></div>
</blockquote></div><br></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@<wbr>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/CAANG%3DkUmThSamFisncxMCaqFd6Ze7GWH-q=
%2BTjMn4YfFTn2T8%2Bw%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Df=
ooter" target=3D"_blank">https://groups.google.com/a/<wbr>isocpp.org/d/msgi=
d/std-<wbr>proposals/CAANG%<wbr>3DkUmThSamFisncxMCaqFd6Ze7GWH-<wbr>q%2BTjMn=
4YfFTn2T8%2Bw%40mail.<wbr>gmail.com</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/CALmDwq3powZ_ytSPztv%3DZz-TryE1jcDwDs=
DhtoABggvcFeJK%2Bg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmDwq3powZ_=
ytSPztv%3DZz-TryE1jcDwDsDhtoABggvcFeJK%2Bg%40mail.gmail.com</a>.<br />

--f4f5e808dde8ad2a8c05671f7c7a--

.
