Retrieving array length across computer languages

The upcoming revision of the C language standard (for now called C2y) is about to feature a new operator that essentially is a standardization of ages old sizeof arr / sizeof arr[0] trick for getting number of elements in an array. But as we all know, beside cache invalidation, and off-by-one errors, the 2nd hard problem in Computer Science is naming things.

Initially it was supposed to be just a quick e-mail during the discussion with just few examples, but as I've gone into the rabbit hole, it somehow ended in a white paper format. You can read that version on the WG14 website as document N3402.

I'm fairly sure over 100 languages listed in the "official" document is good enough sample size of a prior art to decide upon good name for C language, thus to not spam the committee further, any updates and additions I'll list here, in this blogpost copy of the paper.

Enjoy!

 

[so2024] [tiobe] [ieee] [github] [godbolt] [so-tags]

Getting length of array-like objects #

Languages using "size" #

Languages using "length" #

Languages using "count" #

Languages using other words #

Languages using symbols #

Languages where length is computed #

Languages where arrays are implemented by users #

Observations #

 

##

ProgrammerHumor