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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  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) ?