#### Archived

This topic is now archived and is closed to further replies.

# Error produced only when not debugging

This topic is 5178 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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]

##### Share on other sites
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

##### Share on other sites
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.

• ### Forum Statistics

• Total Topics
628682
• Total Posts
2984201

• 13
• 12
• 9
• 10
• 10