I am writing a custom C99 parser. I got the grammar from this link. This grammar says following is a valid syntax for declaring arrays -
int arr[*];
Relevant part of the grammar is follwing -
direct-declarator ::=
identifier
"(" declarator ")"
direct-declarator "[" type-qualifier-list? assignment-expression? "]"
direct-declarator "[" "static" type-qualifier-list? assignment-expression "]"
direct-declarator "[" type-qualifier-list "static" assignment-expression "]"
direct-declarator "[" type-qualifier-list? "*" "]"
direct-declarator "(" parameter-type-list ")"
direct-declarator "(" identifier-list? ")"
I tried compiling a code with this declaration using gcc. It gave me following warning -
error: ‘[*]’ not allowed in other than function prototype scope
So I tried declaring a function prototype with this type of syntax and it compiled without any error or warning. What I am not getting is what can this syntax possibly mean semantically. Any expert with an explanation?