Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs
From: Ingo Molnar
Date: Wed Jun 08 2016 - 05:20:52 EST
* H. Peter Anvin <hpa@xxxxxxxxx> wrote:
> On 06/08/16 02:01, Ingo Molnar wrote:
> >
> > That's a divergence with an underlying reason - but not harmonizing the return
> > code is an unforced error AFAICS and can be fixed.
> >
>
> Perhaps. It is also no real question that "bool" is the right return
> type for a single bit. Changing that in all architectures at one time
> is a major undertaking, however, and it seems to me that it would be
> better to leave that to the respective architecture maintainers.
Yeah, so extrapolating from past performance in most cases that is really a
shorthand for 'it will never happen' :-/
Also, unless I'm missing something it's not really 'hard' or dangerous per se to
do that change for every architecture, just incredibly boring! ;-)
I'm not sure how much it matters though, given other asymmetries in the bitops API
signatures - does anyone have any preferences?
> Perhaps I'm wrong, but I'd really like to avoid the upcasting to "int"
> which isn't needed, because in my testing I find that it definitely
> encourages gcc to generate poor code.
Yeah, absolutely. I hate 'bool' with a vengence but if 'int' generates worse code
with modern compilers then I'm not going to argue for worse code. Would a 'char'
return type be very weird?
Thanks,
Ingo