Re: rfc: ARRAY_AND_SIZE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux