ANSI typedef rules
Henry Spencer
henry at zoo.toronto.edu
Sun Mar 17 09:31:50 AEST 1991
In article <793 at llnl.LLNL.GOV> rjshaw at ramius.llnl.gov (Robert Shaw) writes:
>In regards to ANSI C, what (if anything) does the standard say about
>an identifer that is in the scope of both a typedef and a variable
>declaration by the same name?
There is no such thing. Only one of the two will be visible at any
given place. Taking your example:
>typedef int thing;
> {
> thing t2;
> int thing;
> thing t3; /** (2) breaks **/
The declaration of `thing' as an int variable hides the declaration as
a type name in the outer scope. From the semicolon ending `int thing;'
until the closing brace, `thing' is the name of a variable, not a type.
--
"But this *is* the simplified version | Henry Spencer @ U of Toronto Zoology
for the general public." -S. Harris | henry at zoo.toronto.edu utzoo!henry
More information about the Comp.lang.c
mailing list