Re: [PATCH 1/2] x86/bootflag: Change some static functions to bool

From: Jiri Slaby
Date: Wed Feb 26 2025 - 02:21:49 EST


On 26. 02. 25, 8:17, H. Peter Anvin wrote:
On February 25, 2025 10:31:37 PM PST, Jiri Slaby <jirislaby@xxxxxxxxxx> wrote:
On 24. 02. 25, 19:58, Ingo Molnar wrote:
So this CodingStyle entry is a red herring, and the !! is absolutely
used in the kernel

label1:

Sure, for intended conversion to either 0 or 1.




as an explicit marker of intentional type conversion
to bool.

With this in mind, you would have to write "if (!!x)" everywhere.

I don't want such constructions in code I maintain. (Nor for return values.) But this is not code I maintain (obviously), so your call after all.

thanks,

Uh, no, that's not the point.

The point is that:

!!x

... is the same as

x ? true : false

... which if promoted to an integer, intentionally or not, becomes

x ? 1 : 0

Which I write at label1 above. Sorry, am I missing something?


"!!x" when implicitly converted to bool is the very same as simple "x".

--
js
suse labs