Sign in to follow this  
VprMatrix89

Wierd problem

Recommended Posts

I have this class and a private variable that is set in the constructor, and is never changed there-after. Later on in a class function it is used and is somehow incorrect, holding the wrong value. However, if I redefine it in the function itself it works correctly. and I've searched through the code with cntrl-f to make sure it is used nowhere else. Strangest thing I've encountered yet and no known solution, if it helps the variable is a private integer, but I dont see this causing a problem.

Share this post


Link to post
Share on other sites
It sounds like a bad pointer access, buffer overrun, inconsistent alignment or other similar problem. Did you try defining the variable as const to make sure nothing in your code actually does alter it? Or setting a data breakpoint on the value to see when something does change it?

Share this post


Link to post
Share on other sites
I don't see anything DirectX-specific about this, moved to 'For Beginners' - you may wish to dig up Richard 'superpig' Fine's article on debugging. It'll give you some more insight into solving this sort of problem and explain some of SiCrane's suggestions.

Cheers,
Jack

Share this post


Link to post
Share on other sites
Put a breakpoint in your constructor to make sure it's being called and used correctly.

Then put a hardware breakpoint for writes to the address of the variable. This should catch anything that is altering the value.

If it doesn't hit the breakpoint then chances are you are acessing the variable incorrectly in some way. Check your scope and such.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this