I noticed a strange behavior of a for cycle...
Case 1:
Let us have an internal initialization of i variable
for ( int i=10; i <=10; i++)
{
std::cout << i;
}
return 0;
Output:
10
Case 2:
Now we initialize i outside the cycle
int i = 10;
for ( ; i <=10; i++)
{
std::cout << i;
}
return 0;
Output:
Nothing will be print
Case 3:
Initialization any variable not related to i:
int i = 10;
for ( int k = 0 ; i <=10; i++)
{
std::cout << i;
}
return 0;
Output:
10
Question
How can depend a result of a cycle condition on the place where we initialize variable i?
Updated results
I traced a code using degugger and VS 2010 really jumps over a cycle in case 2. However g++ works well. Maybe a bug in compiler?
Fianal results After reboot it works correcly. Something between heaven and earth. Sorry for the useless question....