type0identifiers as identifier

Jonathan Wakely jwakely.gcc@gmail.com
Fri Mar 18 16:35:00 GMT 2016


On 18 March 2016 at 16:24, vijay nag wrote:
> Hello GCC,
>
> GCC compiles the below code snippet without any noise though the
> type-identifier "foo" is used as identifier in the function
> PrintHello.
>
> My C99 parser failed to parse and I'm wondering if it is a GNU
> extension ? Can someone give plausible explanation as  to why it is a
> legitimate C program ?

This is not valid C99 because you didn't include <stdio.h> for the
declaration of printf, and because you didn't declare "PrintHell()".

It's not an error for the same identifier to denote different entities
at different scopes. The declaration of foo at file scope is hidden by
the declaration of foo at function scope.



More information about the Gcc-help mailing list