When good code goes bad

Reason #26972593-1 why I hate C++ development:  Just fixed up some broken logic pertaining to binding names in the language service.  All tests pass when running debug, but everything fails when running free.  Normally when this happens it's due to me not initializing a variable (what a great feature that is!) and a dummy value was picked that ended up working in debug.  For example you have something like:

if (foo == bar) {

}

And you haven't initilized foo or bar so they both got a dummy value of something like 0xecececec.  So the test works in debug (which follows what you expected because you thought both values would be 0.  However, in retail the values are totally gibberish and it's broken.  Determing what the actual problem is a exercise in unhappiness.  Stepping through retail code is possible, but it's not fun.  My personal favorite is when you have code like:

if (FAILED(hr = DoSomething())) {
    return hr;
}

When you step over the call to DoSomething you'll land on the “return hr;” line making you think that that call failed.  You then step back (or re-run) and walk through the DoSomething method to find out what failed.  It actually didn't fail, but with all the compiler otpimizations in place what you're probably actually seeing is the current location moving to jsut after the return and the IDE just picking an unfortunate location to say where you are.  So you've wasted 5 minutes trying to walk through that code only to find out that there was nothing wrong with it.  Sigh...

Oh well, some day I'll be off this bloody language :-)

Edit: I traced through it and it did indeed turn out to be an unintialized class field.  Why isn't there a warning a can turn on to let me know about this?? Is there a warning that I just don't know about??  I don't think that there are words to express how much I love this language.