public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: kernel-janitors@vger.kernel.org
Subject: Re: rfc: ARRAY_AND_SIZE
Date: Fri, 09 Aug 2013 08:15:20 +0000	[thread overview]
Message-ID: <alpine.DEB.2.02.1308091013390.2295@hadrien> (raw)
In-Reply-To: <5204A345.5060605@bfs.de>

On Fri, 9 Aug 2013, walter harms wrote:

> hi list,
> while looking at Julias nice patch. i notice the ARRAY_AND_SIZE macro
> it looks like that:
>
> #define ARRAY_AND_SIZE(x)       (x), ARRAY_SIZE(x)
>
> I see problem: hiding an argument in function calls is bad.
> (personally i hate hiding arguments in function calls therefore i am not objective)
>
> the next problem is that it is defined 6 times in different locations.
> (see:http://lxr.free-electrons.com/ident?i=ARRAY_AND_SIZE)
>
> But so far it is used in the ARM tree mostly.
>
> Is there any policy on that ?

It is indeed quite disconcerting.  For example, I found the following:

arch/arm/mach-pxa/stargate2.c

991         i2c_register_board_info(0, ARRAY_AND_SIZE(stargate2_i2c_board_info));
992         i2c_register_board_info(1, stargate2_pwr_i2c_board_info,
993                                 ARRAY_SIZE(stargate2_pwr_i2c_board_info));

On the other hand, with ARRAY_AND_SIZE, one is sure that the two arguments
are the same...

julia

  reply	other threads:[~2013-08-09  8:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09  8:07 rfc: ARRAY_AND_SIZE walter harms
2013-08-09  8:15 ` Julia Lawall [this message]
2013-08-09  9:10 ` Dan Carpenter
2013-08-09  9:23 ` Julia Lawall
2013-08-09  9:36 ` Dan Carpenter
2013-08-09 12:32 ` walter harms

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=alpine.DEB.2.02.1308091013390.2295@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    /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