[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <674a80d3-8a85-4d5a-a083-f948643479c6@kernel.org>
Date: Wed, 26 Feb 2025 08:21:39 +0100
From: Jiri Slaby <jirislaby@...nel.org>
To: "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...nel.org>
Cc: Uros Bizjak <ubizjak@...il.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH 1/2] x86/bootflag: Change some static functions to bool
On 26. 02. 25, 8:17, H. Peter Anvin wrote:
> On February 25, 2025 10:31:37 PM PST, Jiri Slaby <jirislaby@...nel.org> 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
Powered by blists - more mailing lists