220 40345 <5df28d28-a2f4-47cd-9da7-49c91ed6d6f4@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Johnny Shaw <johnnyshaw02@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: =?UTF-8?Q?=5Bstd=2Dproposals=5D_Enforce_explicit_casting_on_assignme?=
	=?UTF-8?Q?nt_and_return_type_=E2=80=98bool=E2=80=99?=
Date: Fri, 5 Oct 2018 18:48:32 -0700 (PDT)
Lines: 455
Approved: news@gmane.org
Message-ID: <5df28d28-a2f4-47cd-9da7-49c91ed6d6f4@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1003_1879950856.1538790512417"
X-Trace: blaine.gmane.org 1538790388 15944 195.159.176.226 (6 Oct 2018 01:46:28 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 6 Oct 2018 01:46:28 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC527NWS3ELBB4NI4DOQKGQEJAPJ3ZA@isocpp.org Sat Oct 06 03:46:24 2018
Return-path: <std-proposals+bncBC527NWS3ELBB4NI4DOQKGQEJAPJ3ZA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw1-f71.google.com ([209.85.161.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC527NWS3ELBB4NI4DOQKGQEJAPJ3ZA@isocpp.org>)
	id 1g8bfk-000441-EI
	for gclcip-std-proposals@m.gmane.org; Sat, 06 Oct 2018 03:46:24 +0200
Original-Received: by mail-yw1-f71.google.com with SMTP id b70-v6sf8099436ywh.3
        for <gclcip-std-proposals@m.gmane.org>; Fri, 05 Oct 2018 18:48:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=/uNECuZstQe1UBUIaE28+KwPhaUsicdLUP+zHayRJbc=;
        b=eC+jPIq1lF4VJ0zW8vyk1nhmZArVuMnFUsBiIzhCJ7gJWV7ybLKqE740V6GvlA2BBN
         yCTk1jZ4NQKkz+r4vr2awkM9oec4gB6C5gdSWDE27Yy6e2oIe9ea6n1VHOjTaI4HC6uM
         GE8lcY44mPHgGwz9/Uws26/d6KwFJe14MGN3AGEPrfciIOcePL7v+L+oj+1WgkCwaBnW
         YcMmj+iJBTqK5tMvtUV53I5O8X0VkbMtIl92xJLrLSRDzM20iCoZwatm/3l57OOh5LgD
         iQ70NM0A1cihhqmb/x0394waUueG3jlrENQDm6wNtVXQQll1MHItRXQe3DRV0D5LsG2o
         KI5Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=/uNECuZstQe1UBUIaE28+KwPhaUsicdLUP+zHayRJbc=;
        b=XEZFAKbwv3zKsXTVD2TJWSSECBTr/IazkSNrmLWJb6CQIxsEGKO0A53HGUoiDVeJ9h
         Gub/xVyN988EW/Zq2fNRg8OO3odNkdrvNLZyDMKOJC16/fndmSw9ch0Y0N2B47ZQcy1b
         uvZydQdJwO3q0Olo9Xso0eoA7kVhKXVLybOG48/SACE8wtxlAZZkb3UiADBPInbA0Vwc
         6KCoim1R+gT7Qk8gSMNZtVyfMffqTfg7qyU5xYOLWhYIp9S+W0d9QBekYuEr1VnhZcl3
         bWAbXMkxNbhGghbj7OnWPX7LKUobgO/zVK68xkeOFM0fy3FtaLVF0GZk/CiJPQAEnMzV
         Si8w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:subject:mime-version
         :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=/uNECuZstQe1UBUIaE28+KwPhaUsicdLUP+zHayRJbc=;
        b=fkw8Xrtx+RRxvEs7EVCyYCiYPQoaoZw4CRNAUSIMubOn1kOvaGy7/3Cv4VUEJgPTkx
         MaOCnfXQ5B+xdiTYiGxBPVbI656389QaIyBOSF7JCwyONSqJDuAr/jZ/Mc2vqg6h5FxB
         VDaswTTfBWFkPtdni7jrWMJoeyNbylCOPIIuz/aio4SaY0Z6GFtEoO6fP+gu3sGKX0Q1
         owGQDDZmsX87VbXG+WWv3hI/HcpZxgF7zvCiCexuf84SB8qiTn86EQLo8B3sEPdw1Z5c
         KLQiX5S0hKosq3lvCf9LYmPli7Yp9/wHlvsDfHLEsRbgqMM5q2Ed0Fejp5j1vU597rzl
         c2Mg==
X-Gm-Message-State: ABuFfoiFroLTduyLfdO8n8JtQCtswxsNLCjWxEyBiJMQCLum/lFf9mo7
	cBv+v+c2aE82v9flLttiAcoRCw==
X-Google-Smtp-Source: ACcGV61nKoHLAX9qYVkDM7zV/vEoe1GG0Wb04Z8SjT/tcIyJYcXuTWyaZ4nlbtnFJqtcL4EgpQiAJw==
X-Received: by 2002:a25:390a:: with SMTP id g10-v6mr8005205yba.40.1538790514604;
        Fri, 05 Oct 2018 18:48:34 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a25:8081:: with SMTP id n1-v6ls2676984ybk.21.gmail; Fri, 05
 Oct 2018 18:48:33 -0700 (PDT)
X-Received: by 2002:a25:1c83:: with SMTP id c125-v6mr144142ybc.6.1538790512902;
        Fri, 05 Oct 2018 18:48:32 -0700 (PDT)
X-Original-Sender: JohnnyShaw02@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:40345
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40345>

------=_Part_1003_1879950856.1538790512417
Content-Type: multipart/alternative; 
	boundary="----=_Part_1004_845694214.1538790512418"

------=_Part_1004_845694214.1538790512418
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



Recently I=E2=80=99ve noticed some interpretations of the following standar=
ds=20
resulting in removing of compiler warnings around implicit conversions to a=
=20
=E2=80=98bool=E2=80=99 type:

=20

1) C++14 =C2=A74.12/1 =E2=80=9CA zero value, null pointer value, or null me=
mber pointer=20
value is converted to false; any other value is converted to true. For=20
direct-initialization (8.5), a prvalue of type std::nullptr_t can be=20
converted to a prvalue of type bool; the resulting value is false.=E2=80=9D
2) C99 and C11 =C2=A76.3.1.2/1 =E2=80=9CWhen any scalar value is converted =
to _Bool, the=20
result is 0 if the value compares equal to 0; otherwise, the result is 1.=
=E2=80=9D

=20

Specifically, the VS1017 compiler has removed the following warning=20
completely:

https://msdn.microsoft.com/en-us/library/b6801kcy.aspx

=20

Over correspondence with Microsoft I=E2=80=99ve noticed it my be due to dir=
ect=20
interpretation of standards. See:

https://developercommunity.visualstudio.com/content/problem/346302/vs2017-1=
58-c-fails-to-warn-when-forcing-int-to-boo.html

https://developercommunity.visualstudio.com/content/problem/349342/visual-s=
tudio-2017-158-allows-implicit-conversion.html

=20

This is moving the bar backward a bit, resulting in unintended bugs being=
=20
overlooked that would have previously been caught by the compiler.

=20

While there is value in implicit conversion under some circumstances.=20
Explicit conversion clearly identifies the intent and eliminates mistakes.=
=20
Enforcing a standard that requires explicit conversion to bool, at very=20
least for a return value, will eliminate possible coding errors. The=20
following are some mundane examples and could be overlooked with given more=
=20
complex code:

=20
bool TestFunc(int a)
{
    return a;=20
}=20

bool TestFuncNotOver100(int a)=20
{=20
    if (a > 100)=20
    {=20
        return a;
    }=20
    return true;=20
}=20

bool TestPointerForNull(void* pvX)=20
{
    if (nullptr !=3D pvX)=20
    {
        return false;=20
    }=20
    return pvX;=20
}


=20

At very least requiring a check against a matching type by boolean=20
operation, for example:

bool TestFunc(int a)
{
    return (0 =3D=3D a);=20
}


=20

Or for assignment:

=20
int a =3D 1;
bool bValue =3D (0 =3D=3D a);


=20

Moreover, requiring an explicit cast:

=20
bool TestFunc(int a)
{
    return static_cast<bool>(a);=20
}


--=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/5df28d28-a2f4-47cd-9da7-49c91ed6d6f4%40isocpp.or=
g.

------=_Part_1004_845694214.1538790512418
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><p class=3D"MsoNormal">Recently I=E2=80=99ve noticed some
interpretations of the following standards resulting in removing of compile=
r
warnings around implicit conversions to a =E2=80=98bool=E2=80=99 type:<o:p>=
</o:p></p>

<p class=3D"MsoNormal">=C2=A0<o:p></o:p></p>

<p class=3D"MsoNormal"><sup><span style=3D"font-size: 7pt; font-family: Ari=
al, sans-serif; color: rgb(36, 39, 41); border-width: 1pt; border-style: no=
ne; border-color: windowtext; padding: 0in; background-image: initial; back=
ground-position: initial; background-size: initial; background-repeat: init=
ial; background-attachment: initial; background-origin: initial; background=
-clip: initial;">1)</span></sup><span style=3D"font-size: 9pt; font-family:=
 Arial, sans-serif; color: rgb(36, 39, 41); background-image: initial; back=
ground-position: initial; background-size: initial; background-repeat: init=
ial; background-attachment: initial; background-origin: initial; background=
-clip: initial;">=C2=A0C++14
=C2=A74.12/1 =E2=80=9CA zero value, null pointer value, or null member poin=
ter value is converted
to=C2=A0</span><code><span style=3D"font-size: 10pt; font-family: Consolas;=
 color: rgb(36, 39, 41); border-width: 1pt; border-style: none; border-colo=
r: windowtext; padding: 0in; background: rgb(239, 240, 241);">false</span><=
/code><span style=3D"font-size: 9pt; font-family: Arial, sans-serif; color:=
 rgb(36, 39, 41); background-image: initial; background-position: initial; =
background-size: initial; background-repeat: initial; background-attachment=
: initial; background-origin: initial; background-clip: initial;">; any oth=
er
value is converted to=C2=A0</span><code><span style=3D"font-size: 10pt; fon=
t-family: Consolas; color: rgb(36, 39, 41); border-width: 1pt; border-style=
: none; border-color: windowtext; padding: 0in; background: rgb(239, 240, 2=
41);">true</span></code><span style=3D"font-size: 9pt; font-family: Arial, =
sans-serif; color: rgb(36, 39, 41); background-image: initial; background-p=
osition: initial; background-size: initial; background-repeat: initial; bac=
kground-attachment: initial; background-origin: initial; background-clip: i=
nitial;">. For direct-initialization (8.5), a prvalue of type=C2=A0</span><=
code><span style=3D"font-size: 10pt; font-family: Consolas; color: rgb(36, =
39, 41); border-width: 1pt; border-style: none; border-color: windowtext; p=
adding: 0in; background: rgb(239, 240, 241);">std::nullptr_t</span></code><=
span style=3D"font-size: 9pt; font-family: Arial, sans-serif; color: rgb(36=
, 39, 41); background-image: initial; background-position: initial; backgro=
und-size: initial; background-repeat: initial; background-attachment: initi=
al; background-origin: initial; background-clip: initial;">=C2=A0can be con=
verted to a prvalue of type=C2=A0</span><code><span style=3D"font-size: 10p=
t; font-family: Consolas; color: rgb(36, 39, 41); border-width: 1pt; border=
-style: none; border-color: windowtext; padding: 0in; background: rgb(239, =
240, 241);">bool</span></code><span style=3D"font-size: 9pt; font-family: A=
rial, sans-serif; color: rgb(36, 39, 41); background-image: initial; backgr=
ound-position: initial; background-size: initial; background-repeat: initia=
l; background-attachment: initial; background-origin: initial; background-c=
lip: initial;">; the resulting value is=C2=A0</span><code><span style=3D"fo=
nt-size: 10pt; font-family: Consolas; color: rgb(36, 39, 41); border-width:=
 1pt; border-style: none; border-color: windowtext; padding: 0in; backgroun=
d: rgb(239, 240, 241);">false</span></code><span style=3D"font-size: 9pt; f=
ont-family: Arial, sans-serif; color: rgb(36, 39, 41); background-image: in=
itial; background-position: initial; background-size: initial; background-r=
epeat: initial; background-attachment: initial; background-origin: initial;=
 background-clip: initial;">.=E2=80=9D</span><span style=3D"font-size:9.0pt=
;font-family:&quot;Arial&quot;,sans-serif;
color:#242729"><br>
</span><sup><span style=3D"font-size: 7pt; font-family: Arial, sans-serif; =
color: rgb(36, 39, 41); border-width: 1pt; border-style: none; border-color=
: windowtext; padding: 0in; background-image: initial; background-position:=
 initial; background-size: initial; background-repeat: initial; background-=
attachment: initial; background-origin: initial; background-clip: initial;"=
>2)</span></sup><span style=3D"font-size: 9pt; font-family: Arial, sans-ser=
if; color: rgb(36, 39, 41); background-image: initial; background-position:=
 initial; background-size: initial; background-repeat: initial; background-=
attachment: initial; background-origin: initial; background-clip: initial;"=
>=C2=A0C99 and
C11 =C2=A76.3.1.2/1 =E2=80=9CWhen any scalar value is converted to=C2=A0</s=
pan><code><span style=3D"font-size: 10pt; font-family: Consolas; color: rgb=
(36, 39, 41); border-width: 1pt; border-style: none; border-color: windowte=
xt; padding: 0in; background: rgb(239, 240, 241);">_Bool</span></code><span=
 style=3D"font-size: 9pt; font-family: Arial, sans-serif; color: rgb(36, 39=
, 41); background-image: initial; background-position: initial; background-=
size: initial; background-repeat: initial; background-attachment: initial; =
background-origin: initial; background-clip: initial;">, the result is 0 if=
 the value compares equal to 0; otherwise, the
result is 1.=E2=80=9D</span><o:p></o:p></p>

<p class=3D"MsoNormal">=C2=A0<o:p></o:p></p>

<p class=3D"MsoNormal">Specifically, the VS1017 compiler has
removed the following warning completely:<o:p></o:p></p>

<p class=3D"MsoNormal"><a href=3D"https://msdn.microsoft.com/en-us/library/=
b6801kcy.aspx">https://msdn.microsoft.com/en-us/library/b6801kcy.aspx</a><o=
:p></o:p></p>

<p class=3D"MsoNormal">=C2=A0<o:p></o:p></p>

<p class=3D"MsoNormal">Over correspondence with Microsoft I=E2=80=99ve
noticed it my be due to
direct interpretation of standards. See:<o:p></o:p></p>

<p class=3D"MsoNormal"><a href=3D"https://developercommunity.visualstudio.c=
om/content/problem/346302/vs2017-158-c-fails-to-warn-when-forcing-int-to-bo=
o.html">https://developercommunity.visualstudio.com/content/problem/346302/=
vs2017-158-c-fails-to-warn-when-forcing-int-to-boo.html</a><o:p></o:p></p>

<p class=3D"MsoNormal"><a href=3D"https://developercommunity.visualstudio.c=
om/content/problem/349342/visual-studio-2017-158-allows-implicit-conversion=
..html">https://developercommunity.visualstudio.com/content/problem/349342/v=
isual-studio-2017-158-allows-implicit-conversion.html</a><o:p></o:p></p>

<p class=3D"MsoNormal">=C2=A0<o:p></o:p></p>

<p class=3D"MsoNormal">This is moving the bar backward a bit,
resulting in unintended bugs being overlooked that would have previously be=
en
caught by the compiler.<o:p></o:p></p>

<p class=3D"MsoNormal">=C2=A0<o:p></o:p></p>

<p class=3D"MsoNormal">While there is value in implicit
conversion under some circumstances. Explicit conversion clearly identifies=
 the
intent and eliminates mistakes. Enforcing a standard that requires explicit
conversion to bool, at very least for a return value, will eliminate possib=
le
coding errors. The following are some mundane examples and could be overloo=
ked
with given more complex code:<o:p></o:p></p>

<p class=3D"MsoNormal">=C2=A0<o:p></o:p></p>

<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; ov=
erflow-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #008;" class=3D"styled-by-prettify">bool</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #606;" class=3D"styled-by-prettify">TestFunc</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><font color=3D"#000000"><span style=3D"color: #000;" class=3D"=
styled-by-prettify">=C2=A0 =C2=A0 </span></font><span style=3D"color: #008;=
" class=3D"styled-by-prettify">return</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> <br></span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br=
><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">bool<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">TestFuncNotOver100</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> a</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> <br></span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> <br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">if</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">a=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #066;" class=3D"styled-by-prettify">100</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> <br>=C2=A0 =C2=A0 </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> <br></span><font color=3D"#000000"><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 </span></font><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">return</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 a</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> <br>=C2=A0 =C2=A0=
 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">return</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">true</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> <br></span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> <br><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">bool</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">TestPointerForNull</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">void</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">*</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> pvX</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> <br></span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">if</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">nullptr</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">!=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> pvX</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br>=C2=A0 =
=C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">return</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">fa=
lse</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br>=C2=A0 =C2=
=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br>=C2=A0 =C2=
=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">return=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> pvX</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> <br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></code></div><=
p class=3D"MsoNormal"><br><o:p></o:p></p>

<p class=3D"MsoNormal">=C2=A0<o:p></o:p></p>

<p class=3D"MsoNormal">At very least requiring a check against a
matching type by boolean operation, for example:<o:p></o:p></p>

<br>

<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; ov=
erflow-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #008;" class=3D"styled-by-prettify">bool</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #606;" class=3D"styled-by-prettify">TestFunc</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">return</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D=3D</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> <br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span></div></code></div><p class=3D"MsoNormal"><=
br><o:p></o:p></p>

<p class=3D"MsoNormal">=C2=A0<o:p></o:p></p>

<p class=3D"MsoNormal">Or for assignment:<o:p></o:p></p>

<p class=3D"MsoNormal">=C2=A0<o:p></o:p></p>

<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; ov=
erflow-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #008;" class=3D"styled-by-prettify">int</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> a </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">1</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">bool</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> bValue </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><s=
pan style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">=3D=3D</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">);</span></div></code></div><p class=3D"MsoNormal=
"><br><o:p></o:p></p>

<p class=3D"MsoNormal">=C2=A0<o:p></o:p></p>

<p class=3D"MsoNormal">Moreover, requiring an explicit cast:<o:p></o:p></p>

<p class=3D"MsoNormal">=C2=A0<o:p></o:p></p>

<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; ov=
erflow-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #008;" class=3D"styled-by-prettify">bool</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #606;" class=3D"styled-by-prettify">TestFunc</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">return</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">sta=
tic_cast</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&l=
t;bool&gt;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">a</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> <br></span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">}</span></div></code></div><p c=
lass=3D"MsoNormal"><br><o:p></o:p></p></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/5df28d28-a2f4-47cd-9da7-49c91ed6d6f4%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5df28d28-a2f4-47cd-9da7-49c91ed6d6f4=
%40isocpp.org</a>.<br />

------=_Part_1004_845694214.1538790512418--

------=_Part_1003_1879950856.1538790512417--

.
