Note that you could
static void qux(int n, int a[n])
but this changes the interface somewhat and there are lots of reasons why you might want to avoid VLAs in C.Proper array types are not present in C and they're unlikely to be added at any point in the future, so if the conversation is "the array data and length need to be combined into a single semantic entity", then the conversation is no longer about C, but the starting point for choosing another language.
The int a[static 6] syntax made it into the language because it's a small enough change that it's not disruptive to existing uses of C, but it still has some benefit (I've used it, I've seen its benefits).
VLAs had a poor cost/benefit because they're just too awkward to use. 20 years experience with D shows that the [] syntax knocks it out of the park.
Any combination of static/fat arrays can be made for multidimensionality. For example,
[..][3] array of 3 fat pointers
[3][..] fat pointer to 3 element array
[3][3] array of 3 3-element arrays
[..][..] fat pointer to array of 3 fat pointers
etc.My other questions are how do you create one of these fat pointers, how do you get the length, etc. This sounds to me like VLAs, but with a bigger change to the language, but unable to handle multidimensional arrays. VLAs, for all their faults, at least fit into the language for users well enough that people accidentally use them all the time (not necessarily a good thing).
T[3][4][..] a;
> length a.lengthI'd even be happy if the standard just included a macro like:
#define ARRAY(T) struct { T *ptr, size_t len }
Along with a few functions for working with such types.
Although that would be kind of unwieldy to use in C, since you would need a typedef to actually use any specific types.
So long, you can look at my experiments using a struct type here: https://github.com/uecker/noplate/
The typedef thing will go away with C2X where you do this in place.
static void qux(int n, int *a);
static void qux(int n, int a[]);
static void qux(int n, int a[*]);
static void qux(int n, int a[n]);
static void qux(int n, int a[12345]);
Weird interface problems mainly come when you have VLA types behind pointers.