mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Ingo Molnar <mingo@kernel.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Saidgani Musaev <cpu808694@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arch/x86/boot: sizeof macro
Date: Mon, 8 Jan 2018 13:44:24 -0800	[thread overview]
Message-ID: <202c72f5-3cf3-472e-8ecf-0f388fb0ef9f@zytor.com> (raw)
In-Reply-To: <20180106115020.abragiirty5edis5@gmail.com>

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

      reply	other threads:[~2018-01-08 21:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-29 18:30 Saidgani Musaev
2017-12-29 18:41 ` Andy Shevchenko
2017-12-29 19:34   ` hacku
2017-12-29 19:46   ` Ingo Molnar
2017-12-31 11:48     ` Andy Shevchenko
2017-12-31 16:33       ` Joe Perches
2018-01-06 11:50       ` Ingo Molnar
2018-01-08 21:44         ` H. Peter Anvin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202c72f5-3cf3-472e-8ecf-0f388fb0ef9f@zytor.com \
    --to=hpa@zytor.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=cpu808694@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®