[Top][All Lists]

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

Re: [Qemu-devel] [PATCH] Remove typedef for bool from eepro100.c

From: Reimar Döffinger
Subject: Re: [Qemu-devel] [PATCH] Remove typedef for bool from eepro100.c
Date: Thu, 27 Aug 2009 18:43:00 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Thu, Aug 27, 2009 at 06:25:44PM +0200, Stefan Weil wrote:
> Reimar Döffinger schrieb:
> > 2) all assignments to bool variable are converted to 0/1 which could
> > make a speed difference (not here since the code actually does that
> > explicitly).
> >   
> Only C++ compilers do convert bool assignments to false / true.

Better learn the language you use.
>From the C99 spec: Boolean type
  1 When any scalar value is converted to _Bool, the result is 0 if the value 
compares equal
    to 0; otherwise, the result is 1.

stdbool.h defines bool to _Bool. As such the typedef is a horrible idea
since it behaves wrong.

reply via email to

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