lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <48D5742F.6080305@free.fr>
Date:	Sun, 21 Sep 2008 00:07:43 +0200
From:	Chris Moore <moore@...e.fr>
To:	Christer Weinigel <christer@...nigel.se>
CC:	Alexey Dobriyan <adobriyan@...il.com>,
	Russ Dill <russ.dill@...il.com>, linux-kernel@...r.kernel.org,
	Cyrill Gorcunov <gorcunov@...il.com>,
	Ben Dooks <ben-linux@...ff.org>,
	linux-arm-kernel@...ts.arm.linux.org.uk
Subject: Re: kernel.h: add ARRAY_AND_SIZE() macro to complement	ARRAY_SIZE().

Christer Weinigel a écrit :
> 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.
>   

ARRAY_LENGTH and ARRAY_AND_LENGTH would be better names IMHO.

AIUI the usual convention is to use :-
- "size" for the size in the sizeof sense; i.e. (in most 
implementations) the size in _bytes_,
- "length" for the size in the sense of the number of _elements_ in an 
array (sizeof(array) / sizeof((array)[0])) which seems to be the 
intention here.

Cheers,
Chris


--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ