lkml.org 
[lkml]   [2017]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/fpu: fix boolreturn.cocci warnings
On Tue, 7 Mar 2017, Ingo Molnar wrote:
>
> * kbuild test robot <fengguang.wu@intel.com> wrote:
>
> > arch/x86/kernel/fpu/xstate.c:931:9-10: WARNING: return of 0/1 in function 'xfeatures_mxcsr_quirk' with return type bool
> >
> > Return statements in functions returning bool should use
> > true/false instead of 1/0.
>
> Note that this is a totally bogus warning. I personally find a 0/1 return more
> readable than a textual 'true/false', even if bools are used, and nowhere does the
> kernel mandate the use of 0/1.

I disagree.

The fact that booleans have been brought retroactively into the C-Standard
does and for compability reasons C still follows the approach "Boolean
values are just integers" does not make it any better.

We had stupid bugs, where people returned -EINVAL from a boolean function
and introduced silly and hard to understand bugs.

The canonical values assigned to booleans are 'true' and 'false' and not
whatever people prefer. Can we please be consistent on that?

Thanks,

tglx

\
 
 \ /
  Last update: 2017-03-07 09:34    [W:0.077 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site