[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202c72f5-3cf3-472e-8ecf-0f388fb0ef9f@zytor.com>
Date: Mon, 8 Jan 2018 13:44:24 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Ingo Molnar <mingo@...nel.org>,
Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Saidgani Musaev <cpu808694@...il.com>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] arch/x86/boot: sizeof macro
On 01/06/18 03:50, Ingo Molnar wrote:
>
> We probably don't want to change then, and my point was that 99.8% of the current
> usage is as a 'function':
>
> triton:~/tip> git grep 'sizeof(' | wc -l
> 116570
>
> triton:~/tip> git grep 'sizeof [:alnum:]' | wc -l
> 177
>
> i.e. your patch moves it in the exact wrong direction.
>
The bottom test is bogus as it is fairly common to do "sizeof *foo" in
addition to "sizeof foo":
: tazenda 139 ; git grep -P 'sizeof\s*[^\(\s]' | wc -l
2085
... but it certainly doesn't change the fact that the kernel coding
style is quite unambiguous. However, I don't think it makes any sense
to patch just for the sake of patching.
I personally like the additional visual clarification (backed by
compiler assertion) that the argument is specifically an object, not a
type ("sizeof type" is invalid), but that's not the prevalent use in
kernel code.
-hpa
Powered by blists - more mailing lists