I remember a bug in the printf() implementation for PDCLib that drove me to distraction. You can still see the comment
here.
I hadn't checked in the source before I got this working, but the code I had gave
almost correct results. I had been trying to track this bug down for
weeks (not full time, of course, this has always been a spare-time endeavour). And I did spend virtually all of the Breakpoint 2006 demo party staring at the code, stepping through the debugger and generally tearing my hair out.
And then, after three days of drinking, eating junk food, and staring at the screen in frustration, it struck me like... well...
-- I was adding
to the wrong variable...
(Unfortunately I hadn't checked in the previous version of the source yet, as I wanted it to
work before checking in, so I cannot show you the diff.)
I had a similar issue at the office once, where I
did spend almost two weeks full-time trying to nail down a bug, which turned out to be something along the lines of a sign error. I was ashamed to report this to my superior. But he smiled and said:
"Every bug is trivial... once you've found it."
Similarities of that uttering with my signature are not coincidental.