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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -