RE: typedef name question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michael,

Not a bug.

The "foo foo;" introduces the foo variable.  Once the foo variable is introduced, it shadows (hides) the outer symbol identifier.

If you try to move the "typedef int foo;" inside the function, you'll notice that the "foo foo;" causes a compiler error, because you have the identifer "foo" redeclared in that scope.

You are allowed to introduce identifiers in a scope that shadow identifiers outside that scope.  Even in the "foo foo;" case, where you are using an outer scope identifier and in the process are introducing a new identifier that shadows that self-same outer scope identifier.

HTH,
--Eljay



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux