Re: kernel.h: add ARRAY_AND_SIZE() macro to complement ARRAY_SIZE().

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Christer Weinigel
Date: Saturday, September 20, 2008 - 6:05 am

Alexey Dobriyan wrote:

You still haven't explained what's misnamed about it, nor suggested a 
better name.


You haven't written a lot of machine definitions then.  When adding 
platform devices for an embedded platform one has to write a lot of 
boilerplate like this:

     platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));

and it is much too easy to copy paste that line and miss one of the 
references.


ARRAY_AND_SIZE -> (An) array and (its) size

ARRAY_SIZE -> (The) array size

Sure, you could write ARRAY_AND_ITS_SIZE, but would that really make 
anyone happy?  Cobol went out of fashion a long time ago.

   /Christer

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: kernel.h: add ARRAY_AND_SIZE() macro to complement ARR ..., Christer Weinigel, (Sat Sep 20, 6:05 am)
Re: kernel.h: add ARRAY_AND_SIZE() macro to complement ARR ..., Christer Weinigel, (Sat Sep 20, 7:28 am)
Re: kernel.h: add ARRAY_AND_SIZE() macro to complement ARR ..., Christer Weinigel, (Sat Sep 20, 9:38 am)