This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] __builtin_expect cleanup for iconv{,data}/*.c


> On 09/10/2014 02:07 PM, Roland McGrath wrote:
> > The preferred style in glibc has always been to eschew implicit Boolean
> > coercions, except for the return value of strcmp/memcmp and the like (where
> > the most common idiomatic uses treat the value as a Boolean even though
> > nonzero values have further meaning).
> > 
> 
> Wikified.
> 
> https://sourceware.org/glibc/wiki/Style_and_Conventions#Boolean_Coercions

I forgot to mention the other exception: if (foo & BIT) or if (!(foo & BIT))
is fine, no need for if ((foo & BIT) != 0) or if ((foo & BIT) == 0).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]