[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] fix GCC 5.0.0 logical-not-parentheses warni
From: |
Radim Krčmář |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] fix GCC 5.0.0 logical-not-parentheses warnings |
Date: |
Wed, 4 Mar 2015 17:27:50 +0100 |
2015-03-04 17:36+0300, Michael Tokarev:
> 20.02.2015 19:06, Radim Krčmář wrote:
> > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> > - if (!!n->vhost_started ==
> > - (virtio_net_started(n, status) && !nc->peer->link_down)) {
> > + if ((virtio_net_started(n, status) && !nc->peer->link_down) ==
> > + !!n->vhost_started) {
>
> btw, can this be rewritten as
> (bool)n->vhost_started
> instead of
> !!n->vhos_started
Yes. (It's the same as long as we use bool from stdbool.h.)
> Not questioning the patch itself, just wondering, as these
> double-negatives look ugly...
Casting to bool looks better to me as well, yet the QEMU design guide,
`grep $x | wc -l`, greatly prefers bangs.
I think that it is best to define it as bool in struct VirtIONet,
but I prefer not to change decision that I don't understand ...
Thanks for accepting the patches.