220 20695 <2081160.jZretSXBOl@tjmaciei-mobl4> article
Path: news.gmane.org!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Null -conditional and -coalescing operators
Date: Tue, 22 Sep 2015 23:11:33 -0700
Lines: 35
Approved: news@gmane.org
Message-ID: <2081160.jZretSXBOl@tjmaciei-mobl4>
References: <4c3e2ee7-2159-4e93-a439-7d5c94c38c9c@isocpp.org> <d871b34e-cb96-4826-b52f-72fa0fdb104e@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1442988708 24076 80.91.229.3 (23 Sep 2015 06:11:48 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 23 Sep 2015 06:11:48 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBGEFRGYAKGQEMB3SAIA@isocpp.org Wed Sep 23 08:11:40 2015
Return-path: <std-proposals+bncBCB4TK757YBRBGEFRGYAKGQEMB3SAIA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-la0-f69.google.com ([209.85.215.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCB4TK757YBRBGEFRGYAKGQEMB3SAIA@isocpp.org>)
	id 1ZedHG-0003aZ-9f
	for gclcip-std-proposals@m.gmane.org; Wed, 23 Sep 2015 08:11:38 +0200
Original-Received: by lagj9 with SMTP id j9sf17775166lag.0
        for <gclcip-std-proposals@m.gmane.org>; Tue, 22 Sep 2015 23:11:37 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:to:subject:date:message-id:user-agent
         :in-reply-to:references:mime-version:content-type: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=y7jFg1ZDfNOJzsq+7IWMJiY+6uN+0p8J0rzdcFkaSow=;
        b=V3ioTim/pDr5Cl1WzEWHhoy134LhiSi2A61v+Wa2h3bwgo+gpWnCpPDPMQSohmBBBy
         l+mcI+vMFrQw1/ZP1RcFyJSwgdf/iiC/l23k6V7jX6j1NMah15CbeOdflLX1rTeQ3AkE
         6gm+GoZSw8+jNAl30KLt9EUcgcuPRgD3/MgMTirRUxuD7SG995dcK60Q3Voxc97b3BCd
         dzYEovvKqxIf+k6qYqoBOR6Sw8s8FfhF7RN1GZSL9NxIqZev6qHW8/4cjQhng3N00spY
         9Te3l/TT6fzaN3Z2FjfeL4Dhq2JLh4B+8pfsTnZb4lEQhtBuizjYHdFz5udJ7dVPMMok
         4o8A= 
X-Gm-Message-State: ALoCoQk9NYDKyyhfjWIq0ek0WaLe+nY+X+OwcyAAxNKFp4AfRNyWvDQ/lRGYaP3qqfa/5aVKVIdz
X-Received: by 10.112.125.104 with SMTP id mp8mr4960558lbb.20.1442988697369;
        Tue, 22 Sep 2015 23:11:37 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.96.163 with SMTP id dt3ls1052936wib.42.canary; Tue, 22 Sep
 2015 23:11:36 -0700 (PDT)
X-Received: by 10.180.8.101 with SMTP id q5mr1930035wia.16.1442988696384;
        Tue, 22 Sep 2015 23:11:36 -0700 (PDT)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [78.47.120.188])
        by mx.google.com with ESMTP id fl6si29684827wib.15.2015.09.22.23.11.36
        for <std-proposals@isocpp.org>;
        Tue, 22 Sep 2015 23:11:36 -0700 (PDT)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) client-ip=78.47.120.188;
Original-Received: from tjmaciei-mobl4.localnet (unknown [IPv6:2601:1c0:5803:81c9:e16a:f933:34c6:6d])
	by gondolin.macieira.info (Postfix) with ESMTPSA id 7209811B4A6
	for <std-proposals@isocpp.org>; Tue, 22 Sep 2015 23:11:35 -0700 (PDT)
User-Agent: KMail/4.14.9 (Linux/4.1.6-1-desktop; KDE/4.14.9; x86_64; ; )
In-Reply-To: <d871b34e-cb96-4826-b52f-72fa0fdb104e@isocpp.org>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mailfrom=thiago@macieira.org
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:20695
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/20695>

On Tuesday 22 September 2015 17:34:20 joewoodbury@gmail.com wrote:
> 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.

This does not do the same as the above. It does:

	bool tmp = wcslen(pStr) < strLen;
	strLen = tmp ? tmp : strLen;

That is, it assigns 1 to strLen if the conditional was true.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

-- 

--- 
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/.

.
