Author Topic: Magic debugger?  (Read 2538 times)

sketchbr

  • Guest
Magic debugger?
« on: December 03, 2008, 02:56:51 am »
hey guys,
I'm making a game as a project for the university and I've come across a few problems...
When I compile and execute the project in codeblocks the program is closed during execution, which suggests some logic errors. 
That's fine. But when I debug the same project, with no alterations and no breakpoints, the game runs normally, no errors!
How is that possible?

So, that's what I want to know: in what way does debugging a project influence on it's execution?
Does it treat things like memory protection differently?

Thanks!

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Magic debugger?
« Reply #1 on: December 03, 2008, 09:36:20 am »
You have something like if(ptr) *ptr = blah; or if(ptr) delete ptr; somewhere in your code, but you never initialise ptr to 0, so it points to some undefined address (which isn't 0).
The debugger initialises all variables, so it works as expected.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."