I had a problem with a piece of code last night. An apparent infinite loop without apparent cause. Because I’m working on in-development tools, though, I couldn’t even go to disassembly.
I sat and stared this morning at the offending code, knowing I must be missing something.
I finally went down the hall to grab Nathan (I like Nathan. He’s bright and hard working, and he laughs at my jokes. Good man.). He isn’t as experienced with C++ as I am, but my experience wasn’t helping me. Besides, it was a problem with a bloody for-loop.
Nathan sat down, complained about what I named the function, and then point out the error. Less than two minutes.
Can you see the error?
for (GenericParam* Param = StartOfListOfParams; Param; Param->GetNext())
I feel a little dumb, but vindicated for my position on code reviews, especially for my own code.
Edit 08/11/07 11:28am: Added a space.