Sponsored By

Newsletter #50 - Debugged Lists

Problems with std::list, new sketches, and a community spotlight article.

Michael Grand, Blogger

October 15, 2009

2 Min Read


News

No news to report this week.


From the Programmer
Written by Invisible

I ran into a rather odd problem this week. I was creating the workbench for the rendering system, which seemed to be working fine... Until I ran it in debug mode and it crashed.

After poking around in the code for a bit, I found out that the crash was being caused by attempting to iterate through an std::list. However, I was unable to recreate the bug in a testbed project. Out of ideas, I was about to quit for the day when I had a sudden inspiration: The rendering system's workbench was being ran in debug mode, but the static libraries that it used were compiled in release mode. Sure enough, after using debug versions of the static libraries, the program ran perfectly fine.

Curious to know exactly what was causing the problem, I made a copy of the workbench and the libraries that it used and slowly stripped away code that wasn't affecting the crash. Here is the code that I was left with: http://codepad.org/ibTVTcOv

Line #29 interests me in particular. Since that if statement should never be entered, you would think that lstList->begin(); would have no affect on anything. However, if that is changed to lstList->size(); or simply removed, the problem does not occur. The only explanation I can think of is that std::list::begin() is inline, which must somehow escape the if statement or cause corruption of the code. A debug version of std::list is being placed into a release version on line #26, but since only a pointer is assigned, std::list should be none the wiser.


Artist's Easel
Written by GreyKnight

iScribble Sketches #8

(Click to enlarge)

(Click to enlarge)

 


Community Spotlight
Written by Invisible

Jaythemage has released another community spotlight video. Check it out here: http://www.youtube.com/watch?v=gniKypFQLUA

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like