Debug mode differences?

BlitzMax Forums/BlitzMax Programming/Debug mode differences?

jhans0n(Posted 2010) [#1]
Here's one for you. I have a game I've been working on for a while. I made some minor changes last night (adding a bunch of types that I haven't started using yet).

Now, my game compiles fine in release mode but not in debug. In debug, I get a null pointer error referencing max2d.bmx. I traced it back to a CollideRect call (specifically when it uses CreateQuad). I'm not using any ?debug blocks or anything like that so the code is the same both ways.

I'm confused as to how/why adding some types that I'm not even calling yet would have any impact on the code's ability to compile, let alone just in debug mode. Any ideas?


GfK(Posted 2010) [#2]
Check back up the stack to see how you ended up passing a null object down to max2d.bmx. If it doesn't compile in debug mode, then something is definitely wrong that needs sorted.

No error checking is done in release mode for optimum speed, so it might work sometimes, then other times you'll get a memory access violation.


Jesse(Posted 2010) [#3]
I bet anything you want, that you are making use of some code that calls the collideRect some where in your code. there is no logical reason why code would execute on its own sense the only way it can be executed is by creating an instance of it and/or calling it. if there is a way you can put those types in external file and run your program that way you'll either find out that the problem is not with those types or that you are calling the type/object from somewhere.

Last edited 2010


Jesse(Posted 2010) [#4]
Sorry for the double post. I edited the post 7 minutes afer creating the post and it created a double post.
this new post edit set up is a mess.

Last edited 2010


jhans0n(Posted 2010) [#5]
I am calling CollideRect in part of the program, but the weird part is that that portion of the code hasn't changed at all. Literally, all I did was add some types. They're simple types at the moment with just a handful of fields each, mostly integers, and a clone function for each. None of them are being used in the code yet.

I can make the problem go away by changing the order of how I'm initializing a few things, so fixing the error is not a problem, but I am totally perplexed as to why it compiled fine, even in debug mode, until the unused types were added.


Czar Flavius(Posted 2010) [#6]
I can make the problem go away... so fixing the error is not a problem


If you don't know why the problem went away, it's not really fixed.

On the debugger you can use the stack trace to go through all the functions called prior to the function where you had the Null error. Try to find the point in your program where the Null object was sent down the chain.


jhans0n(Posted 2010) [#7]
I know why it went away. I was calling CollideRect before calling my Graphics command. I just don't get why it worked like that until I added those types.


Czar Flavius(Posted 2010) [#8]
What were the types