PHP - count
Python - len
C++ - .size (vector)
C - macro or stored
C# - .Length
Good naming in programming is an art.
To be logical at all, the name should be "numelemsof" or "countelemsof" ... but I guess, those names are already to long for C purists ...
I on my part (in spite using C myself) think that typing code is not that problem, but typing the right code. And -- at least when you are not alone programming -- every code line is read 10 or more times more often than it is written. So, to be clear and understandable is much more valuable to me, than come away with less strokes ...
The best investment in my career I ever made is, typing class in high school. It has separated me from the crowd at every job. Its more important that so many other irrelevant 'purist' ideals.
But when I look back at my career, I never had the feeling, to be to slow in typing even for Module II -- a language, that would never ever get the approval of the "C purists".
Doing refactoring, I use a simple trick myself -- I do much copy and paste ;) ... and delete (!) the copied stuff afterwards.
I think, as a programmer, it is a good property to be lazy -- but you should merely use it for code reuse instead for avoiding typing.
Oh, I forgot: I use vim, a typing avoidance editor. You can avoid lot of keystrokes or mouse moves with that editor. But not to avoid real content.
What do you think of the auto keyword in C++? I've personally never found typing out the types to be a problem.
But I don't think, that "auto" was specified to reduce typing. I see it more as a possibility to follow the "DRY" principle (don't repeat yourself).
There might be cases, where for example the return types of functions might change and you don't want to change every caller.
Templates are of course an other example, because the return types of templates oftentimes are depending of the input types. You of course can use those template declaration stuff, but it is very ugly and oftentimes clumsy.
I also found a nice example, where it really can help to make things more easy to read, here:
I think, the real usages are rare, that is also the reason, it was specified rather late.
Whenever you write a new type, just write a sizing function for it using sizeof. I like that Go is taking a similar route, except that one just implements the signature.