EDIT – just changed it so that it’s just an int, now it gets a value
of -82938723047 or some such number. why on earth is this happening?
It’s ruining my program!
You are almost certainly barking up the wrong tree. The code:
for (int i = 0;
…initializes i
to 0
, period. If you’re trying to spy its value in the debugger and the debugger says i
has a value that looks like uninitialized, garbage data, then you are probably looking at i
either before or after i
has entered scope and been initialized. For example, in MSVC if you examine i
before you enter the loop for the very first time, it will often have garbage data.
These are not the droids you’re looking for. Move along.
Much more likely is this code:
level.PathLookupVectors()[globalNodePositionIndex][globalNodeChoice].size()
This is probably not doing what you think it’s doing.
By the way, if the type of level.PathLookupVectors()[globalNodePositionIndex][globalNodeChoice]
is a vector
of some kind, I’d prefer that you use a for
loop constructed like this.
/*psudocode*/ for( vector::iterator it = v.begin(), it_end = v.end(); it != it_end; ++it )
If you don’t need the index of the element you’re trying to access, then why refer to it? You’re just introducing another potential failure point in your code.
solved why is this for loop taking so long?