Everyone makes mistakes

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.

6 Responses to “Everyone makes mistakes”

  1. Jonathan Says:

    It doesn’t look like you’re modifying the variable you’re testing. :-)

  2. Andrew Says:

    Which, oddly enough, leads to slight performance issues, like never finishing. Good call! You get a gold smiley: :-)

  3. Jonathan Says:

    Hooray for gold similies! :-) :-)

  4. Jonathan Says:

    Wait, I meant smilies, not similies, though a gold simile would also be awesome.

    (What’s up with the gold smiley converter? Does it only do the first smiley in a paragraph? Smiley 1 :-) , Smiley Two :-) , Smiley Three :-) .)

  5. Andrew Says:

    Err. Honestly? I didn’t know it was there at all. I’m going to have to look into it. Personally, I was looking for a gold star: (s) ?

  6. Andrew Says:

    :!:

Leave a Reply