typedefs

John Marshall jlm at amdahl.UUCP
Sat Nov 17 02:27:56 AEST 1984


Who said typedefs don't have scope?  Typedef names are identifiers,
and as such have a scope.  Section 8.8 (Appendix A, K&R)
makes this clear.

Also see section 11.1, page 206, which even includes a
specific example:

typedef float distance;
...
{
	auto int distance;
	...

Pcc has a problem in this area, but
Amdahl's UTS C compiler handles these constructions correctly.

Incidently, I believe the following is even correct:

....
typedef int foo;
{
	typedef float foo;
....

where the identifier refers to type int in the outer block,
but to type float in the inner block.



More information about the Comp.lang.c mailing list