Re: [PATCH] arch/x86/boot: sizeof macro
From: H. Peter Anvin
Date: Mon Jan 08 2018 - 16:49:02 EST
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