This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] __builtin_expect cleanup for iconv{,data}/*.c
- From: Kalle Olavi Niemitalo <kon at iki dot fi>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Wed, 10 Sep 2014 20:53:06 +0300
- Subject: Re: [PATCH v2] __builtin_expect cleanup for iconv{,data}/*.c
- Authentication-results: sourceware.org; auth=none
- Keywords: implicit Boolean coercion
- References: <540E06B0 dot 50406 at redhat dot com> <540F501B dot 2080808 at redhat dot com> <87ha0g4adb dot fsf at Niukka dot kon dot iki dot fi> <541001AC dot 50107 at redhat dot com>
Florian Weimer <fweimer@redhat.com> writes:
> Has glibc a rule not to rely on implicit booleans? Than the != 0
> variant would be preferred.
I'm not sure. Roland McGrath has objected to implicit Boolean coercion
before; see <https://sourceware.org/ml/libc-alpha/2012-09/msg00218.html>
and <https://sourceware.org/ml/libc-alpha/2014-06/msg00119.html>.
If there is a consensus, then I guess someone should edit
<https://sourceware.org/glibc/wiki/Style_and_Conventions>, in which
some examples of good patterns nowadays do "if (buf)" or similar.
The GNU Coding Standards don't discuss the issue, AFAICS.