Friday, October 17, 2008
Yeah, I had to put a goto into the code today. I suck.
I promise I'll take it out when I have time to do some refactoring. But you see, when some moron writes an 872-line function with eleven levels of if and while statements, it's difficult to find ways to clean things up.
I like Knuth's supposed quip "Structured Programming Using Goto Statements" (rumouredly sub-titled "'Goto Statement Considered Harmful' Considered Harmful")
So now we have a situation where people use a statement almost like a dirty word, and publish their confessions on their blog for repentence ...
I used 3 gotos recently in the same function (first time for something like 5+ years, although I hadn't done much C recently), although admittedly it was "very scratch demo code" (would've been refactored if it weren't being thrown away). The first comment said something along the lines of "burning in hell" for the use of goto, and by the third it was "getting crispy now" (and they were all exiting to a common cleanup point).
See, now you've got me confessing. :-/