[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: EARRAYSIZE
From: |
Eli Zaretskii |
Subject: |
Re: EARRAYSIZE |
Date: |
Fri, 04 Apr 2014 10:45:30 +0300 |
> From: David Kastrup <address@hidden>
> Date: Thu, 03 Apr 2014 22:10:08 +0200
>
> 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.
I suggested ALEN because we have AREF and ASIZE. Maybe AELTS or
ALENGTH would be better.