Name Space of typedef Names

Names declared using typedef occupy the same name space as other identifiers (except statement labels). Therefore, they cannot use the same identifier as a previously declared name, except in a class-type declaration. Consider the following example:

typedef unsigned long UL;   // Declare a typedef name, UL.
int UL;                     // Error: redefined.

The name-hiding rules that pertain to other identifiers also govern the visibility of names declared using typedef. Therefore, the following example is legal in C++:

typedef unsigned long UL;   // Declare a typedef name, UL.
...
long Beep
{
    unsigned int UL;        // Redeclaration hides typedef name.
    ...
}
// typedef name "unhidden" here.