220 20842 <53c897d6-8bd0-4f07-af6a-9f7ac99ed6ea@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: joewoodbury@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Null -conditional and -coalescing operators
Date: Sat, 26 Sep 2015 13:11:39 -0700 (PDT)
Lines: 108
Approved: news@gmane.org
Message-ID: <53c897d6-8bd0-4f07-af6a-9f7ac99ed6ea@isocpp.org>
References: <4c3e2ee7-2159-4e93-a439-7d5c94c38c9c@isocpp.org>
 <d871b34e-cb96-4826-b52f-72fa0fdb104e@isocpp.org>
 <a116fdf2-266d-4e85-b0ab-b205bcc9ca70@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_4021_641098898.1443298299612"
X-Trace: ger.gmane.org 1443298324 8160 80.91.229.3 (26 Sep 2015 20:12:04 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 26 Sep 2015 20:12:04 +0000 (UTC)
Cc: joewoodbury@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCBMHLUN7EEBB7HXTOYAKGQEPH3VQ3A@isocpp.org Sat Sep 26 22:11:49 2015
Return-path: <std-proposals+bncBCBMHLUN7EEBB7HXTOYAKGQEPH3VQ3A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pd0-f198.google.com ([209.85.192.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCBMHLUN7EEBB7HXTOYAKGQEPH3VQ3A@isocpp.org>)
	id 1Zfvos-000531-Bi
	for gclcip-std-proposals@m.gmane.org; Sat, 26 Sep 2015 22:11:42 +0200
Original-Received: by pdbnu13 with SMTP id nu13sf245079626pdb.3
        for <gclcip-std-proposals@m.gmane.org>; Sat, 26 Sep 2015 13:11:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:content-type:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=6pLMY0ts71g1aVEXURkf8S3v1Cb/QjUDIp5qmK9KgHI=;
        b=aI4TwUKvnexxbcTWn6jZYotKmJOYkLhjBhq0U9Sn1Ie4xj7pXCL564g6MmDpGxYtgk
         PrM6Qy/tPg5R/QMre4CrTChdC2tC5RDYFiuedmDRUCFSev6Sn88FdRcZoXoGecnaiOXU
         M83wQsLQEDki3FXA0BPNh8KmD22ZRTdZZZVRc0UKmyU6DIfiOoY2sj7Nf2lAL+Q620/G
         qZnwcf3ycC6ACjP9Ud/1Bn1JqII6nIZSIHk79B2Oc8ADy5/fy9vMvIIHAHsDY/QJLNWt
         TRr8Ht9LMVUkGVtEzn3Tgnp+RBMXOC53irhueDX/OopJf/O03DvDvmQWkXKFHG7X2r0L
         +YKA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:content-type:x-original-sender
         :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=6pLMY0ts71g1aVEXURkf8S3v1Cb/QjUDIp5qmK9KgHI=;
        b=GfnIYtUCQsiLw/q81Rl4TogGdBGzlVt/ElEdLTAV8Od0UG9gnjB/KbgUVNaX2wCBUa
         XGQdJuAokcGqKCUrlU4VtMHLFUKe/X8O72NhkDFD48/bBKJjXIyb2DzIiA76AxGwUOD0
         Fdzc4PbiDkMa6qsHYWLJEHK8IMzI+BIhiWBprZMRrjz/3i1Jx1K27vYVAzGKH9VvLazA
         7hWJQG+jD4SGRHbaPkVUQOT3hK871bvJb31qiZ9dwBHvQN0XoS8G2PbS+voE3ZnJh2MX
         xWjS1rjB74lMRTkx87iVDTkYc+4HQRW8PisTlf1gWvSVbpi9WPZlyHT0Qelx7xroHOq3
         o0jQ==
X-Gm-Message-State: ALoCoQkOtyDwfNw1c9MdO+p2oTZa9xdYGcbuG4TOnL11ZjPeSs6RQA/+ZuUaePRfPRv/SVStji9G
X-Received: by 10.66.63.39 with SMTP id d7mr11164330pas.20.1443298301049;
        Sat, 26 Sep 2015 13:11:41 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.164.164 with SMTP id yr4ls500146igb.27.canary; Sat, 26 Sep
 2015 13:11:40 -0700 (PDT)
X-Received: by 10.50.79.136 with SMTP id j8mr91997igx.16.1443298300216;
        Sat, 26 Sep 2015 13:11:40 -0700 (PDT)
In-Reply-To: <a116fdf2-266d-4e85-b0ab-b205bcc9ca70@isocpp.org>
X-Original-Sender: joewoodbury@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: <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:20842
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/20842>

------=_Part_4021_641098898.1443298299612
Content-Type: multipart/alternative; 
	boundary="----=_Part_4022_267548149.1443298299612"

------=_Part_4022_267548149.1443298299612
Content-Type: text/plain; charset=UTF-8

I hang my head in shame. Need to think more before posting.

On Tuesday, September 22, 2015 at 7:53:07 PM UTC-7, Nicol Bolas wrote:
>
>
>
> On Tuesday, September 22, 2015 at 8:34:20 PM UTC-4, joewo...@gmail.com 
> wrote:
>>
>> Here in interesting example I just encountered:
>>
>> strLen is passed into a function along with pStr. After nullptr checks, 
>> the following is done:
>>
>>             size_t tmpStrLen = wcslen(pStr);
>>             if (strLen > tmpStrLen)
>>                 strLen = tmpStrLen;
>>
>> Using the ?: operator, you could do:
>>
>>             strLen = wcslen(pStr) < strLen ?: strLen;
>>
>> Again, a trivial example, but one in actual code.
>>
>
> And this code would have made it much more clear what you were doing:
>
> strLen = std::min(wcslen(pStr), strLen);
>
> Also, I'm not sure how your suggestion is equivalent to the original. I 
> see you have an expression that evaluates to bool. And I see you have an 
> expression which will be evaluated if the boolean expression is true.
>
> I don't see what the value of that expression will be if the boolean 
> expression is false. So I'm not clear on exactly what your code means.
>

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_4022_267548149.1443298299612
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I hang my head in shame. Need to think more before posting=
..<br><br>On Tuesday, September 22, 2015 at 7:53:07 PM UTC-7, Nicol Bolas wr=
ote:<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"><br><br>O=
n Tuesday, September 22, 2015 at 8:34:20 PM UTC-4, <a>joewo...@gmail.com</a=
> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Here in in=
teresting example I just encountered:<br><br>strLen is passed into a functi=
on along with pStr. After nullptr checks, the following is done:<br><br>=C2=
=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 size_t tmpStrLen =3D =
wcslen(pStr);<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 i=
f (strLen &gt; tmpStrLen)<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 strLen =3D tmpStrLen;<br><br>Using the ?: o=
perator, you could do:<br><br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=
=C2=A0=C2=A0 strLen =3D wcslen(pStr) &lt; strLen ?: strLen;<br><br>Again, a=
 trivial example, but one in actual code.<br></div></blockquote><div dir=3D=
"ltr"><br>And this code would have made it much more clear what you were do=
ing:<br><br><div style=3D"background-color:rgb(250,250,250);border-color:rg=
b(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><c=
ode><div><span style=3D"color:#000">strLen </span><span style=3D"color:#660=
">=3D</span><span style=3D"color:#000"> std</span><span style=3D"color:#660=
">::</span><span style=3D"color:#000">min</span><span style=3D"color:#660">=
(</span><span style=3D"color:#000">wcslen</span><span style=3D"color:#660">=
(</span><span style=3D"color:#000">pStr</span><span style=3D"color:#660">),=
</span><span style=3D"color:#000"> strLen</span><span style=3D"color:#660">=
);</span><span style=3D"color:#000"><br></span></div></code></div><br>Also,=
 I&#39;m not sure how your suggestion is equivalent to the original. I see =
you have an expression that evaluates to bool. And I see you have an expres=
sion which will be evaluated if the boolean expression is true.<br><br>I do=
n&#39;t see what the value of that expression will be if the boolean expres=
sion is false. So I&#39;m not clear on exactly what your code means.<br></d=
iv></div></blockquote></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 />

------=_Part_4022_267548149.1443298299612--
------=_Part_4021_641098898.1443298299612--

.
