From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Christer Weinigel <christer@weinigel.se>
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 21:12:16 +0400 [thread overview]
Message-ID: <20080920171216.GD7354@localhost> (raw)
In-Reply-To: <48D5271B.7010109@weinigel.se>
[Christer Weinigel - Sat, Sep 20, 2008 at 06:38:51PM +0200]
> Cyrill Gorcunov wrote:
>> [Christer Weinigel - Sat, Sep 20, 2008 at 04:28:19PM +0200]
>> ...
>>> 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.
>
>> Well, can't agree with you :) It's my _presonal_ opinion.
>> You could define it as
>>
>> static inline int platform_add_devices_array(struct platform_device **devs)
>> {
>> return platform_add_devices(devs, ARRAY_SIZE(devs));
>> }
>
> Won't work. You would have to use a macro. The above would turn into:
>
> platform_add_devices(devs, 1);
>
> or would if the __must_be_array check didn't catch it.
>
> /Christer
>
Ah...indeed, my bad :) gcc is not that smart (yet). So there only
the macro is possible (just forget that it will be different
namespace scope). Anyway even having it like a macro would be
better then hiding args.
- Cyrill -
next prev parent reply other threads:[~2008-09-20 17:12 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 [this message]
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=20080920171216.GD7354@localhost \
--to=gorcunov@gmail.com \
--cc=adobriyan@gmail.com \
--cc=ben-linux@fluff.org \
--cc=christer@weinigel.se \
--cc=eric.y.miao@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