for loop running infinitely in release build(visual studio) in c++ -
i have loop in 1 of projects. running infinitely in release build works fine in debug build. clueless. should expecting memory corruption here? have functions calls in loop not change "j".
for( int j=10 ; j>=0 ; j--){ cout << j << " : " << (j>=0); cout << "entered loop" << endl; func(j); ... cout << "exiting loop" << endl; }
log looks this:
10 : 1 entered
exiting
9:1 entered
exiting
.
.
(ommitted)
.
0 : 0 entered
exiting
-1 : 0 entered
exiting
.
(ommitted)
you have unsigned integer never go below zero; step j-- take largest possible unsigned value when j zero. loop never terminates.
Comments
Post a Comment