[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: EARRAYSIZE
From: |
David Kastrup |
Subject: |
Re: EARRAYSIZE |
Date: |
Thu, 03 Apr 2014 22:10:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
Daniel Colascione <address@hidden> writes:
> On 04/03/2014 12:30 PM, Eli Zaretskii wrote:
>> +/* Find number of elements in array */
>> +#define EARRAYSIZE(arr) (sizeof (arr) / sizeof ((arr)[0]))
>>
>> I find the name of this macro to be unfortunate: what it returns is
>> not "size" in the accepted meaning of that word.
>
> "Length", "size", and "count" are hopelessly confounded anyway. I'm not
> attached to any particular term: I chose EARRAYSIZE because ARRAYSIZE
> and ARRAY_SIZE hace been common in other projects I've worked on.
>
>> How about ALEN, or ARRAYELTS instead?
>
> Of these, I prefer ARRAYELTS. I'll change the name.
Since Elisp has (length "333"), (length '(4 5 6)), and (length [4 5 3]),
for Emacs code LENGTH or LEN should be a reasonably straightforward
naming choice.
--
David Kastrup