Messages in this thread | | | From | David Laight <> | Subject | RE: kernel style preference trivia: '* const' vs '*const' ? | Date | Mon, 10 Oct 2022 11:48:01 +0000 |
| |
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)
| |