Error produced only when not debugging

Started by
1 comment, last by clum 20 years, 6 months ago
This is debatably the weirdest problem I've ever had. I have the following code:

        drawMaskChange();
	cout << "1";
	drawBallStart(x, y, type, intensity);
	cout << "2";
	drawBallChange(type);
	cout << "3";
	drawBallStep(x, y, type, intensity);
	cout << "4";
EDIT: Look at this topic for an explanation of my debugging methods. The code works as it is supposed to and it outputs "1234". However, if I comment out cout << "2";, then it comes up with the following error: Fatal signal: Segmentation Fault (SDL Parachute Deployed) 1 ---------------------------------------------- Program exited successfully with errcode (245) A part of the strangeness is that the 1 is displayed after it comes up with the error message. I use SDL (as I hope you noticed). The drawBallStart() is supposed to draw the mask, while drawBallChange is supposed to bind the texture for the ball. I divided it into these functions because elsewhere in the program it uses them seperately because it firsts draws all the masks, then all of the balls of this colour, then all of the balls of this colour, etc. I can provide code for the functions, though, as I said, they work fine when I add the cout << "2"; and they worked before I made some fundamental changes in my program. Thank you. [edited by - clum on October 10, 2003 11:00:36 AM]
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
Advertisement
You''ve got a memory bug somewhere in your program. Look for the usual suspects: uninitialized pointers, array overflows, returning references to local objects, bad copy constructor/assignment operator behavior, etc. Put some assert statements in your functions/methods to try and catch these things earlier.


--
Dave Mikesell
d.mikesell@computer.org
http://davemikesell.com
Thank you very much. It was an out-of-bounds array. I used a switch statement to determine which element of the array to use and there was one case which I didn''t account for, so it used an unitialized variable as the index.
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)

This topic is closed to new replies.

Advertisement