[PATCH] array_length, array_end macros for internal use
Florian Weimer
fweimer@redhat.com
Sun Oct 22 07:14:00 GMT 2017
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
More information about the Libc-alpha
mailing list