lkml.org 
[lkml]   [2018]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] arch/x86/boot: sizeof macro
From
Date
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

\
 
 \ /
  Last update: 2018-01-14 23:18    [W:0.050 / U:1.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site