But why? Why is this VLA parameter defined this way? It seems totally bizarre and unnecessary, but I suppose it must have been added to the standard to solve some kind of problem? Is the proposal for this feature available and gives some insight?
void concat_strs(
int str1_len,
const char str1[str1_len],
int str2_len,
const char str2[str2_len],
char out_str[str1_len + str2_len],
);
void manipulate_array(
array_dim dim,
int arr[dim.x][dim.y],
);
Supporting things like printf() was probably not specifically desired, but it would be difficult to define it in such a way that it accepts all reasonable expressions and doesn't accept any "unreasonable" ones.The original purpose of VLAs is to let you stack-allocate an array with a length that is not known at compile time. In ANSI C you must heap-allocate such arrays, using malloc.
[1] https://www.open-std.org/jtc1/sc22/wg14/www/wg14_document_lo...