[vbox-dev] [PATCH 2/8] Fix an implicit conversion from pointer to bool

Jung-uk Kim jkim at FreeBSD.org
Fri Mar 27 16:44:31 GMT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 03/27/2015 03:17, Michael Thayer wrote:
> On 26.03.2015 20:48, Jung-uk Kim wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>> 
>> On 03/26/2015 15:25, Michal Necasek wrote:
>>> Sorry, I wasn't clear. By "what is the semantic difference" I
>>> meant "under what circumstances will the conditional behave
>>> differently". There must be some difference because otherwise
>>> what would be the point of a warning?
>> 
>> As I said, it does not behave differently under any
>> circumstances.  It just shuts up compiler warnings.  I think the
>> warning is to make sure its author is using a correct variable,
>> i.e., "A variable of type foo is used where type bar should be
>> used.  Do you really want me to convert it to type bar?" or
>> something like that.
>> 
>> Some people say it's too noisy but I didn't write the compiler.
>> :-P
> 
> I wonder whether it would not make sense to at least get in touch
> with the compiler people here to find out their rationale for the
> warning and potentially open a bug report with them - "if (ptr)" is
> a very well-established convention in C and C++ programming.

I misinterpreted the warnings.  It warns not because of "if (ptr)" but
because of "if (NULL)", i.e., "-Wnull-conversion" (Clang) or
"-Wconversion-null" (GCC).

My apologies,

Jung-uk Kim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJVFYjqAAoJEHyflib82/FGvA8H/1i+pL/k1FF4yyrGYz23yI43
SvcL8Zb/EWoPxmDZpM+rhNFH6v9W2Kh+LG0io5rUK7TA4cBuCZhGBm6LM+PaZRum
99YKC/6PYFvYDiuzIAhKsSXxxPclsRStw5MYgU9ku+GPZsBuu6ivf/A0unEtYf/s
60dOlVK/wItiw4xa/wr2iAYSIhqNChfPNmpEcorrXtW2vrV1OFvJOmI52jRdtZDn
DpuVn5dnzPRQ9F8sBskb3LO6jbIhOQ5vmw/O0MHaTFmLnzEX34qKeVDwYXZ60wbS
+TE9ZBVwkQEzDRsaUiFQ+0ncagJL0+MF0hXQvqprTnjO9xFfStItjkycObKTpc0=
=KzJk
-----END PGP SIGNATURE-----




More information about the vbox-dev mailing list