public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christer Weinigel <christer@weinigel.se>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
	Russ Dill <russ.dill@gmail.com>,
	Eric Miao <eric.y.miao@gmail.com>,
	linux-arm-kernel@lists.arm.linux.org.uk,
	Ben Dooks <ben-linux@fluff.org>,
	linux-kernel@vger.kernel.org
Subject: Re: kernel.h: add ARRAY_AND_SIZE() macro to complement	ARRAY_SIZE().
Date: Sat, 20 Sep 2008 16:28:19 +0200	[thread overview]
Message-ID: <48D50883.6040700@weinigel.se> (raw)
In-Reply-To: <20080920134543.GA7354@localhost>

Cyrill Gorcunov wrote:
> [Christer Weinigel - Sat, Sep 20, 2008 at 03:05:29PM +0200]
>> 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.
> Christer, _I_ was complaining not about naming
> but about hiding function arguments. I suppose
> it's better to define some inline wrapper for
> platform_add_devices then use such a macro.

Sorry about that.  I should have commented the earlier one.

In my opinion, making platform_add_devices into a magic macro is 
actually worse, since the same construct (array, ARRAY_SIZE(array)) is 
used in many places, so one would have to do the same thing over and 
over again for every function.  In that case it's better to have to 
learn one macro once, and the ALL_CAPITALS should make it obvious that 
it is a macro.

  /Christer


  reply	other threads:[~2008-09-20 14:28 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 [this message]
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

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=48D50883.6040700@weinigel.se \
    --to=christer@weinigel.se \
    --cc=adobriyan@gmail.com \
    --cc=ben-linux@fluff.org \
    --cc=eric.y.miao@gmail.com \
    --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