c++ - A Visual Studio 2010 Bug? -
i think found bug in vs2010 (c / c++), seems obvious, cannot believe it.
(in vein of select isn't broken).
please let me know if bug, or if i'm missing something:
int main(void) { int x; // declare variable x; for(int i=0, x = 10; i<5; ++i) // initialize x 10. no way around this. { printf("i %d\n", i); } if (x == 10) // warning c4700: uninitialized local variable 'x' used { printf("x ten\n"); } }
int i=0, x = 10;
you declared second x
variable scoped for
loop.
the outer x
variable not affected.
Comments
Post a Comment