On 4 Oct 2005 07:16:42 -0700,
la********@gmail.com wrote:
I have the following piece of codes:
for (int i = 0; i < 10; i++)
function1();
for (i = 0; i < 5; i++)
function2();
Technically, I should be getting an error in the 2nd for loop but when
I compile the above with Visual .NET, everything compiles fine.
Any ideas what's wrong? I did not define I globally elsewhere.
Thanks
Thierry
There have been many times when I wished I could redefine "I" globally
elsewhere...<g>.
Seriously, though, I would first look for a compiler switch which
turns off the ANSI "for" scope rules regarding the above.
Secondly, I suspect pollution of the global namespace as the culprit.
I would look for any header files, included either directly or
indirectly by your own headers (but including your own headers) which
have "using namespace <whatever>;" in them. One of these MIGHT have
declared "i" at global scope within the local namespace or else at
global scope.
Other than that -- well, perhaps you *did* declare an "i" (or was it
an "I"?? <g>) somewhere at global scope...
--
Bob Hairgrove
No**********@Home.com