[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48D50883.6040700@weinigel.se>
Date: Sat, 20 Sep 2008 16:28:19 +0200
From: Christer Weinigel <christer@...nigel.se>
To: Cyrill Gorcunov <gorcunov@...il.com>
CC: Alexey Dobriyan <adobriyan@...il.com>,
Russ Dill <russ.dill@...il.com>,
Eric Miao <eric.y.miao@...il.com>,
linux-arm-kernel@...ts.arm.linux.org.uk,
Ben Dooks <ben-linux@...ff.org>, linux-kernel@...r.kernel.org
Subject: Re: kernel.h: add ARRAY_AND_SIZE() macro to complement ARRAY_SIZE().
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists