On 06/05/2012 03:02 PM, Paolo Bonzini wrote:
> Il 22/05/2012 12:45, Laszlo Ersek ha scritto:
>> +    if (sock->has_fd + sock->has_listen + sock->has_connect + 
>> sock->has_mcast +
>> +        sock->has_udp != 1) {
> 
> Please add a cast, this doesn't work with C99 bool.

Huh?  Where does C99 state that?

6.3.1.8 states that 'usual arithmetic conversions' consists of first
performing integer promotions (and _Bool promotes to int), then if both
sides of the operand are the same promoted type, no further conversion
is performed.

bool + bool

therefore undergoes integer promotion to

int + int

and the result can be > 1.

Perhaps you are thinking of the gnulib <stdbool.h> replacement, where
the usual arithmetic conventions of gnulib's replacement 'bool' do not
always coincide with C99 semantics?

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to