Re: Question about variable scope conflict



santosh wrote:

Use the -Wshadow switch for gcc.

I never would have thought to call it that.

Any idea where the term "shadow variable" in this context originated? Only two threads using that term have previously appeared in this group, and only two in comp.lang.c++. A bit of googling on the web at large turned up what appear to be different usages of the term for VoiceXML automake, and several others. In most of these it means not overlapping declarations, but using two variables with slightly different names, and often different types, which are operated on similarly in most of the code. Here is a typical use, ironically again with respect to gcc:

http://developer.apple.com/documentation/Performance/Conceptual/CodeSpeed/Articles/ImpedanceMismatch.html

Thanks,

David Mathog
.