On Fri, Jan 20, 2017 at 5:57 AM, Eric Blake <ebl...@redhat.com> wrote: > On 01/19/2017 09:43 PM, Mike Frysinger wrote: >>>>> >>>>> gnulib module + extra checks + name change to ARRAY_SIZE sound good! >>>>> For a convenience feature, ARRAY_CARDINALITY is not a convenient name. >>>> >>>> yeah, "cardinality" sounds more like someone trying to show off their >>>> familiarity with the english language ;). then again, my spell checker >>>> says it's not a word. >>>> >>>> linux, glibc, bootloaders, use ARRAY_SIZE. types use "size" -- it's >>>> size_t, not cardinality_t. this is the first time i've seen this name >>>> used myself. >>> >>> FYI, I chose "cardinality" over "size" quite deliberately: the former >>> refers to the number of things (typically in a set), and while "size" >>> may also refer to that number, it is often used to refer to the number >>> of bytes, which is usually a larger number. >> >> a fair point. i think in practice, people are used to the behavior >> of the macro so it's not an issue. plus, sizeof already does this. > > I like the name ARRAY_SIZE for its shorter length, but agree that > ARRAY_CARDINALITY is a bit more precise. I also agree that since > projects like the kernel are using ARRAY_SIZE that there is now a > familiarity factor so that developers recognize it as being the number > of elements in the array (and not the size in bytes of the array). It's > always possible to create both names (one as an alias forwarding to the > other), if you want to use a preferred spelling in a particular project. > Which name would be better in a gnulib module?
I think the combination of shorter length and increased (since ~2006) popularity of the ARRAY_SIZE name make it ok to switch, now. I would use array-size as the module name.