This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] array_length, array_end macros for internal use
On 10/22/2017 03:36 AM, Paul Eggert wrote:
Florian Weimer wrote:
I didn't want to use array_size because of the potential confusion
with sizeof.
Yes, that's a good reason to avoid that name.
glibc has not followed this style for some time (see libc_hidden_def,
__libc_lock_lock etc.), and the C++ version (if we need it) will be
written as a function anyway.
OK, then how about the "arrayelts", or "array_elts"? "array_length" is a
bit confusion-prone, because "length" is so often one less than the
number of elements.
ELT is the indexing operator in Common Lisp:
<http://www.lispworks.com/documentation/HyperSpec/Body/f_elt.htm>
To me, this name implies dereferencing some kind. I think “length” is
far more intuitive. The difference between array length and string
length is just something we have to live with, it's not going away no
matter which name we choose.
Thanks,
Florian