From: Chris Moore <moore@free.fr>
To: Christer Weinigel <christer@weinigel.se>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
Russ Dill <russ.dill@gmail.com>,
linux-kernel@vger.kernel.org,
Cyrill Gorcunov <gorcunov@gmail.com>,
Ben Dooks <ben-linux@fluff.org>,
linux-arm-kernel@lists.arm.linux.org.uk
Subject: Re: kernel.h: add ARRAY_AND_SIZE() macro to complement ARRAY_SIZE().
Date: Sun, 21 Sep 2008 00:07:43 +0200 [thread overview]
Message-ID: <48D5742F.6080305@free.fr> (raw)
In-Reply-To: <48D4F519.2080509@weinigel.se>
Christer Weinigel a écrit :
> Alexey Dobriyan wrote:
>
>> 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.
>>
>
> You still haven't explained what's misnamed about it, nor suggested a
> better name.
>
ARRAY_LENGTH and ARRAY_AND_LENGTH would be better names IMHO.
AIUI the usual convention is to use :-
- "size" for the size in the sizeof sense; i.e. (in most
implementations) the size in _bytes_,
- "length" for the size in the sense of the number of _elements_ in an
array (sizeof(array) / sizeof((array)[0])) which seems to be the
intention here.
Cheers,
Chris
prev parent reply other threads:[~2008-09-20 22:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-18 13:24 kernel.h: add ARRAY_AND_SIZE() macro to complement ARRAY_SIZE() Ben Dooks
2008-09-18 15:06 ` Alexey Dobriyan
2008-09-18 18:38 ` Eric Miao
2008-09-19 6:54 ` Cyrill Gorcunov
2008-09-19 7:22 ` Eric Miao
2008-09-19 7:32 ` Cyrill Gorcunov
2008-09-19 13:28 ` Stefan Richter
2008-09-19 15:28 ` Russ Dill
2008-09-19 17:55 ` Alexey Dobriyan
2008-09-20 13:05 ` Christer Weinigel
2008-09-20 13:45 ` Cyrill Gorcunov
2008-09-20 14:28 ` Christer Weinigel
2008-09-20 14:45 ` Cyrill Gorcunov
2008-09-20 16:38 ` Christer Weinigel
2008-09-20 17:12 ` Cyrill Gorcunov
2008-09-20 17:33 ` Cyrill Gorcunov
2008-09-20 22:07 ` Chris Moore [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48D5742F.6080305@free.fr \
--to=moore@free.fr \
--cc=adobriyan@gmail.com \
--cc=ben-linux@fluff.org \
--cc=christer@weinigel.se \
--cc=gorcunov@gmail.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=russ.dill@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox