lkml.org 
[lkml]   [2015]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: RFC: kernel coding style: prefer array to &array[0] ?
Joe Perches wrote:
> It seems most in-kernel uses are 'array' rather than '&array[0]'
>
> Most of the time, using array is simpler to read than &array[0].
>
> Exceptions exists when addresses for consecutive members are
> used like func(&array[0], &array[1]);

I use '&array[0]' when I want to get a pointer to a single object that
happens to be the first one in an array.

> Should this preference be put into checkpatch and/or CodingStyle?

How about the following low-hanging fruit?

foo(..., &array[0], ARRAY_SIZE(array), ...)


Regards,
Clemens


\
 
 \ /
  Last update: 2015-07-01 14:01    [W:0.049 / U:0.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site