On 11/18/19 10:53 AM, Peter Krempa wrote:
On Mon, Nov 18, 2019 at 14:47:03 +0100, Michal Privoznik wrote:
> On 11/18/19 2:27 PM, Daniel Henrique Barboza wrote:
>
> I believe it was John who persuaded us to use explicit integer comparison
> for integer variables. The idea is that it's clear from the check itself if
> we are comparing integers or pointers. And I agree with him - in my new code
> I always use 'if (x > 0)' or 'if (x != 0)' instead of 'if
(x)' or 'if (!x)'.
I'll start paying more attention to it in the code I'll be writing too.
We also encourage it officially in our coding style:
https://libvirt.org/hacking.html#conditions
I wasn't aware that (hasFoos == true) was a valid/encouraged format. I took flak
in QEMU doing these kind of things and got used to do the short format whenever
possible. Interesting.
DHB