I am interested in how the compiler parses certain declarations and why does it allow them in the first place.
Consider the following shred of code: int(var);
which most likely nobody would ever write, but it appears to be allowed by GCC C99 for some reason (a language extension?). To me, knowing exactly how the declarations are parsed, this makes sense albeit useless and an obvious bad practice in the slightest.
The problem is that this introduces a new difficulty in parsing declarations as such:
int func ( int(var), int(void) );
Here, since identifiers in argument declarations are optional, the compiler must do what exactly? Attempt to retrieve 'void' as an identifier, but instead of producing an error as usual, allow it since it matches the syntax of a function (void) returning int? This presents a challenge when you would want to parse such a declaration and I want to make sure I am doing it correctly.
It starts to make less sense and become more confusing with declarations like this one:
void c (int())
Because the argument will be treated as a function returning int instead of
void c (int);
Please, shed some light on the subject.