Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6871991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:52:17+00:00 2026-05-27T03:52:17+00:00

the for loop: //for testing, this is usually a value of about 27 int

  • 0

the for loop:

//for testing, this is usually a value of about 27
int test = level.PathLookupVectors()[globalNodePositionIndex][globalNodeChoice].size();

for (int i = 0; i < level.PathLookupVectors()[globalNodePositionIndex][globalNodeChoice].size(); i++)
{
    //adds the correct nodes to the search
    search.push_back(level.Nodes()[level.PathLookupVectors()[globalNodePositionIndex][globalNodeChoice][i]].Index());
}

and it’s a 64 bit system.

I’m getting very strange results for the integer ‘i’ when debugging. it should be initialized to 0 but for some reason it’s a very very high number which in turn means that the for loop is not executing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:52:17+00:00Added an answer on May 27, 2026 at 3:52 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a critical loop in my code with this shape : int myloop(int
I'm getting strange results testing the return value from a function. This code is
Why is this running into an infinite loop, and 'TESTING' never gets printed? It
/// \todo Loop must be rewritten ... /// \todo Delete this loop Can Doxygen
This loop checks if a record is in the sqlite database and builds a
Especially for C# Unit Testing , how to make a test run for various
I have: $overr=array(); $overr[]=array(selector=>array('vi'=>mysql_num_rows($myquery),'pes'=> $pess,'prp'=>mysql_num_rows($my_3_query),'em_t'=>$u_h));//this is in a loop As you can see, I'm
This is a question that goes to how BOOST_FOREACH checks it's loop termination cout
I have read about using CompositionTarget.Rendering Timer for the primary gaming loop in silverlight.
I have this code: void fill_array (unsigned int *iarray, char *string, int max) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.