Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Smooth Moves
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 43642 of 48417
Post > Topic >>

Smooth Moves

by adramolek@[EMAIL PROTECTED] Mar 2, 2008 at 11:14 PM

So I had this bit of strange looking code:

        if (led->m_to[i] != prev &&
            (FCanCrossSelf || !_hit[led->m_to[i]->m_index]));
        {
            cango.push_back(i);
        }

I was having a problem where it was getting into the if statement even
when the condition was supposed to be false. I could not, for the life
of me, figure out what was going on. The condition has so many braces
and arrows and things in it, and I had been staring at it for so long.
Why was it getting into the if statement when the condition was false?
I could print debugging info from inside the statement and verify it
was false. I could step through in my debugger and watch it step into
the statements, even when it evaluated to false. What was going on?

Well it's obvious when I look at it now, but after *over* an hour of
debugging, looking at conditions, looking at other code, checking for
buffer overruns in strange places, I *finally* spotted the damn extra
semicolon I accidentally typed at the end of the "if". See it? It's
right there before that left curly brace.

I slapped myself on the head pretty hard after realizing how dumb the
mistake was. It's not the first time I've spent a long time debugging
a simple syntax mistake like that.

So now, I am taking a break for a few minutes, and I am wondering:
what kinds of horror stories do people here have about silly mistakes
like this one? Hours spent debugging when you typed a j instead of an
i, or put a parenthesis in the wrong spot, an extra semicolon, a
problematic #define. There's got to be some good stories out there!

- AJ
 




 3 Posts in Topic:
Smooth Moves
adramolek@[EMAIL PROTECTE  2008-03-02 23:14:03 
Re: Smooth Moves
"Jim Langston"   2008-03-03 03:12:17 
Re: Smooth Moves
Paavo Helde <nobody@[E  2008-03-06 12:15:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 10:20:17 CST 2008.