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 713285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:56:38+00:00 2026-05-14T04:56:38+00:00

Stepping through the debugger, the BBox object is okay at the entry of the

  • 0

Stepping through the debugger, the BBox object is okay at the entry of the function, but as soon as it enters the function, the vfptr object points to 0xccccc. I don’t get it.

  1. What is causing this ?
  2. Why is there a virtual table reference in there when the object is not derived from other class. (Though, it resides in GameObject from which my Player class inherits and I retrieve the BBox from within player. But, why does the BBox have the reference ? Shouldn’t it be player who should be maintained in that reference ?)

For 1; some code for reference:

A. I retrieve the bounding box from player. This returns a bounding box as expected. I then send its address to GetGridCells.

 const BoundingBox& l_Bbox = l_pPlayer->GetBoundingBox();

 boost::unordered_set < Cell*, CellPHash >& l_GridCells = GetGridCells ( &l_Bbox ); 

B. This is where a_pBoundingBox goes crazy and gets that garbage value.

 boost::unordered_set< Cell*, CellPHash > CollisionMgr::GetGridCells(const BoundingBox *a_pBoundingBox)
 {

I think the following code is also pertinent, so I’m sticking this in here anyways:

 const BoundingBox& Player::GetBoundingBox(void)
 {
 return BoundingBox( &GetBoundingSphere() );
 }

 const BoundingSphere& Player::GetBoundingSphere(void)
 {
 BoundingSphere& l_BSphere = m_pGeomMesh->m_BoundingSphere;

 l_BSphere.m_Center = GetPosition();

 return l_BSphere;
 }

 // BoundingBox Constructor
 BoundingBox(const BoundingSphere* a_pBoundingSphere);

Can anyone please give me some idea as to why this is happening? Also, if you want me to post more code, please do let me know.

Thanks!

  • 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-14T04:56:39+00:00Added an answer on May 14, 2026 at 4:56 am
     const BoundingBox& Player::GetBoundingBox(void)
     {
     return BoundingBox( &GetBoundingSphere() );
     }
    

    Here, you’re returning a reference to a temporary BoundingBox object. That object goes out of scope as soon as the return statement ends.

    Return a BoundingBox instead of a BoundingBox& instead.


    Also:

     BoundingSphere& l_BSphere = m_pGeomMesh->m_BoundingSphere;
    
     l_BSphere.m_Center = GetPosition();
    

    Here, you take a reference to the bounding sphere of the m_pGeomMesh, then modify the value it refers to. This will result in a modification of the original object. Are you sure this is what you want?


    Also:

     // BoundingBox Constructor
     BoundingBox(const BoundingSphere* a_pBoundingSphere);
    

    In the only place where using a reference makes a great deal of sense, you use a pointer instead. Why?

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

Sidebar

Related Questions

Using C# in Visual Studio 2008 and stepping through a function in the debugger
While stepping through a method using the Eclipse debugger, I started seeing toString() unavailable
I was stepping through some C/CUDA code in the debugger, something like: for(uint i
I'm testing a web service in Visual Studio, and stepping through using the debugger.
I would like to implement or use functionality that allows stepping through a Table
I have a project in Java that I am stepping through and when I'm
Is it possible to view the PTX registers when stepping through inline PTX in
So I'm (remotely) debugging a java/jboss application in Eclipse, stepping through line by line.
How to stop Visual Studio debugger from stepping into assembly?
What can be done to skip through the parts of code when stepping through

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.