There are also quite a few requests-for-comments flying about, including clang __counted_by(varname) annotation for pointers, and gcc and clang __element_count(varname) attribute for flexible array members, and various other stuff related to array bounds checking at both compile time and run time –– I prefer the ones that help at compile time, and add zero overhead at run time.
This is definitely something compiler developers and users are thinking a lot about. It just surprises me that the variably modified parameter form is often "forgotten" (it not being new, already defined in C99).
One annoying thing about this form is that the size must precede the array. Most existing C interfaces (like memset()) specify the pointer first, size after, which makes it weird to switch to the size(s) first, then data in array form.
I'm not ashamed (well, maybe a little!) to admit it this better form does not come naturally to me; I do have to consciously choose it. If I don't think at all, I'll just type the pointer form instead, with size after the pointer.
If only the compiler developers were to allow, as an extension, a variably modified parameter to specify a later parameter in the parameter list, we could just change the prototypes of most functions, without affecting the generated machine code at all. Right now, we would need to change the parameter order, but otherwise the generated machine code is not affected.
A big reason why current versions of C compilers do not catch obvious errors, like accessing the n'th element of an n-element array, i.e. just past the end of the array, is that they internally only check arrays of compile-time integer constant length. However, the C99 standard explicitly allows arithmetic operations in the array length, it does not need to be a single parameter. For example,
void foo(size_t bytes, uint32_t data[bytes / sizeof (uint32_t)]);
which would allow you to do stuff like
uint32_t my_buffer[32];
foo(sizeof my_buffer, my_buffer);
To properly support variably modified array parameter bounds checks at compile time, they need to be able to express the array size as an arithmetic expression based on one or more parameters or variables, and compare to access indices involving a similar expression. Right now, the compilers only deal with literal limits known at compile time.
For example, the array count expression above is (bytes/sizeof(uint32_t)), simplifying to (bytes/4). An array index expression could be (bytes/5 + 1). The task to add to compilers, is to be able to compare such expressions, and tell if the latter is equal to or greater than the former. It is not impossible by any means, but quite a bit of work!
(In case you wonder, the array index expression is out of bounds when bytes<=20, and valid when bytes>20. I don't expect the compiler to tell me that, but a warning that "depending on the bytes value, the access may be out of bounds" would be nice. I needed to solve the inequality (bytes/5+1) >= (bytes/4) to find out, which is what the compilers would also need to implement, to fully support compile-time bounds checking; noting that the expressions may contain more than one variable.)
That is why I posted this message, hopefully explaining why the support for such array bounds checking is still in the works, and may not be implemented at all in all C compilers.