[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 12/16] convert net_init_socket() to NetClientOpt

From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 12/16] convert net_init_socket() to NetClientOptions
Date: Tue, 05 Jun 2012 15:14:58 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

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? 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   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]