Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: ANSI typedef rules Message-ID: <1991Mar16.233150.4078@zoo.toronto.edu> Date: Sat, 16 Mar 1991 23:31:50 GMT References: <793@llnl.LLNL.GOV> Organization: U of Toronto Zoology In article <793@llnl.LLNL.GOV> rjshaw@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@zoo.toronto.edu utzoo!henry