RE: kernel style preference trivia: '* const' vs '*const' ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux