Apr
02
2009
0

War Stories

Sitting around a senior design lab watching two people try to debug a sonar device on a robot through a serial connection while helping another guy try to install debian on an old mac which suddenly refuses to open the cd tray (these things happen to me) tends to bring out old programming war stories. As I recall it was when the robot programmers did something wrong and were showered with error dialogs that quickly  covered the screen when we started swapping programming exploits. These are some of my fond memories of times I nearly ended up with my arm elbow-deep in a monitor.

One of my recent homework assignments involved editing a  c++ program. Sure enough, the first time I test it, I get a segfault. The project is really small and simple, so I just went with cout debugging rather than importing the whole thing into eclipse. The results I got, however, were totally eratic. Long story short, I finally realized  that my debug output was causing segfaults whenever I didn’t conclude it with a newline. I have no idea what was in my prof’s code that could cause that to happen, but it did not make me happy. Especially  considering that I still had the original segfault to find… (Turned out to be forgetting a  return statement. How is that not a compile warning?)

I had another head scratching experience while writing code for some goofy chip for embedded systems. As we were working we ran into some kind of compile error, the message for which was totally inscrutable. There was a number in it which I thought might be a line number, so I added a couple lines of whitespace above and recompiled to test that theory….and the program compiled with no error at all. Don’t ask me how that works.

The absolue worst however was when I couldn’t figure out why my constructor wasn’t working in php. The syntax for that, if you’re not familiar with it, is to name the method __constructor(). What you don’t know, and nobody ever bothers to tell you, is that that underscore is not an underscore, but is in fact two (2) underscores. I only discovered this when in utter frustration I copied and pasted the method name from the internet into my code. Imagine my surprise when it actually worked…

Written by RJC in: Uncategorized |

Powered by WordPress | Aeros Theme | TheBuckmaker.com


You do count!