Hi, I was wondering what is the point of the language supporting
nested variable declarations of the same name?
For example:
int a = 0;
if( some_bool )
{
int a = 5;
...
}
cout << a; //this outputs 0
I can't think of a reason why this would be supported, and I feel the
compiler should throw a warning. So, is there a good useful reason to
allow this?
Thanks.
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]