Just was looking something up in the ISO/IEC9899 When I stumbled on this:
6.7.6 Type names
[...]
Semantics
2 In several contexts, it is necessary to specify a type. This is accomplished using a type name, which is syntactically a declaration for a function or an object of that type that omits the identifier.128) 3 EXAMPLE The constructions
(a) int
(b) int *
(c) int *[3]
(d) int (*)[3]
(e) int (*)[*]
(f) int *()
(g) int (*)(void)
(h) int (*const [])(unsigned int, ...)
name respectively the types (a) int, (b) pointer to int, (c) array of three pointers to int, (d) pointer to an array of three ints, (e) pointer to a variable length array of an unspecified number of ints, (f) function with no parameter specification returning a pointer to int, (g) pointer to function with no parameters returning an int, and (h) array of an unspecified number of constant pointers to functions, each with one parameter that has type unsigned int and an unspecified number of other parameters, returning an int.
What most confused me was:
(e) pointer to a variable length array of an unspecified number of ints
The others I can understand more or less. But what is the use of a pointer to a VLA of unspecified number of 'ints'?
And is there even a need for compiler's to support the syntax of
int foo[*];
?
EDIT for clarification
This Question primaly aims on "Is it even neccessary to support this for a compiler?".
Whilest this post ANSI-C grammar - array declarations like [*] et alii clearly improved my knowledge. There is still no answer for: Why does the compiler need to know if the parameter of the prototype just is a address containing unknown size. as with simply doing int foo[]
or it will be unspecified size?
So is this realy neccessary to be supported? And if not so, why the standard even is implementing this semantic?