From: David Laight <David.Laight@ACULAB.COM>
To: 'Joe Perches' <joe@perches.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-doc <linux-doc@vger.kernel.org>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Subject: RE: kernel style preference trivia: '* const' vs '*const' ?
Date: Mon, 10 Oct 2022 11:48:01 +0000 [thread overview]
Message-ID: <58121da1f2ec4d04b939a368bba47f02@AcuMS.aculab.com> (raw)
In-Reply-To: <9ff662d738612f0ed2cea39266768a2eff21edc3.camel@perches.com>
From: Joe Perches
> Sent: 09 October 2022 17:22
>
> The kernel uses '* const' about 10:1 over '*const'
>
> coding_style and checkpatch don't care one way or another.
>
> Does anyone care if there should be some kernel style preference?
I see a wave of patches to 'correct' all the uses...
> $ git grep -P -oh '\b(?:char|u8)\s*\*\s*const\b' -- '*.[ch]' | \
> sort | uniq -c | sort -rn
> 12450 char * const
> 1357 char *const
> 41 u8 * const
> 17 char* const
That one should be an error.
Consider:
char* const foo, bar;
Fortunately the compiler will find those.
I'd guess 'char* foo' is already an error?
Which makes me think the * ought to be as close as possible
to the variable/field name.
So perhaps 'char *const foo' should be ok.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
prev parent reply other threads:[~2022-10-10 11:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-09 16:21 kernel style preference trivia: '* const' vs '*const' ? Joe Perches
2022-10-09 16:52 ` Miguel Ojeda
2022-10-09 21:47 ` Joe Perches
2022-10-10 11:48 ` David Laight [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=58121da1f2ec4d04b939a368bba47f02@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=joe@perches.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
/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