lkml.org 
[lkml]   [2008]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: kernel.h: add ARRAY_AND_SIZE() macro to complement ARRAY_SIZE().
On Fri, Sep 19, 2008 at 08:28:45AM -0700, Russ Dill wrote:
> My vote is for ARRAY_AND_SIZE to spread far and wide across the land.
> ARRAY_SIZE is already very safe, as it has a __must_be_array macro
> built in. So ARRAY_AND_SIZE is even safer, as it prevents you from
> mixing up two different arrays. It also reduces line length and makes
> driver and device (usually platform_device) registration code easier
> to read.

It also spreads ARRAY_SIZE misnaming futher.

It introduces one more core macro and quite pointless one. I can't
personally recall a single bug where sizeof() was taken from another
array.

It creates interesting confusion point: ARRAY_AND_SIZE is about array
and it's size. What ARRAY_SIZE is about then?

You want default argument values in fact, but C is C.

Alexey "(array (nr (length array)))" Dobriyan


\
 
 \ /
  Last update: 2008-09-19 19:57    [W:0.060 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site