ID:2880
 
Keywords: programming
I've been having fun with C++ today. And when I say "having fun with C++", I of course mean "gnashing my teeth in wails of continual frustration, punctuated by occasonal 'aha!' moments".

I've had two nasty crashes so far. The first one was an extremely mysterious Windows-chugging-so-badly-it-now-takes-10-minutes-just-to-st art-shutting-down almost-freeze that claimed 100% CPU, and I still have no idea exactly why it happened. I *think* it had to do with putting some text into an XML file in a place where the program didn't expect it; but due to the very flexible nature of XML, the parser (courtesy of the usually excellent TinyXML library) should have just skipped straight over it without any problems. Yet removing that text fixed the freeze. Very, very strange. I have yet to try replacing the text to see if it makes the freeze happen again; frankly I just hope it goes away and never comes back. It was even painful just trying to operate the start menu while the freeze was taking place.

The second nasty crash was not nearly so nasty in one way - Windows just displayed a "whoops, your program has crapped itself" error message and killed the program, gracefully returning to Dev-C++ with no noticeable slowdown. But it's nearly as nasty in a different way. Namely, I have discovered (via liberal application of the programmer's best friend and world's best debugger, the print statement) that the crash is occurring in bowels of the Lua interpreter that I've embedded into my C++ program. ARRRGH.

If there's anything worse than a mysterious unexplainable crash, it's a mysterious unexplainable crash that happens in someone else's code...
At least Lua is active (they've made a news post on the 11 of August '05?). The only thing worse than an unexplainable crash in someone else's code is an unexplainable crash in someone else's code that they're never going to fix.
Made sure it isn't something you cause? Doing stuff like indexing outside of an array doesn't always crash the program rather it just leaves a time bombs waiting to happen. I know several times I accidently corrupted one of the STL data structures and it didn't crash until it was inside their implementation. These sorts of things are a huge pain to track down and debug :P.
DarkView - Oh yeah. Definitely!

Theodis - I do think that's likely; I just have to find my mistake, because I've been combing the code and so far it's proved elusive to track down. I had a similar crash before when I failed to return a value from a C function that was called from inside Lua code, but that's not the problem now.