memnus: Cartoon kitten after being sprayed with water (Angry kitten (QoW))
Brian ([personal profile] memnus) wrote2005-06-10 06:25 am

Shrift

This week, or more accurately, yesterday and probably today, I've done things that would make any Mudd-trained codemonkey cry.

- Magic numbers. Well, I wasn't the perpetrator of this, but the victim, but I still had to find all the instances of 40 and 41 and change them to 36 and 37 respectively.

- Use of the ?: operator. Personally, I think this one made the code cleaner, but it still gave me pause.

- Use of goto statements.. For this, I have no defense, except that I was mimicking the style already established for similar functions. At least it wasn't a backward goto?

And yet, today I get to go propogate more of that same evil upon the world.

click

[identity profile] willworker.livejournal.com 2005-06-10 04:22 pm (UTC)(link)
I actually found a goto I couldn't figure out until I realized that I was working in a language without a block-comment operator. It was a forward-jumping goto that, essentially, just skipped a block of code. Still, a comment to the effect would be nice, as seeing uncommented code that never runs is a bit confusing.

Steve

[identity profile] neminem.livejournal.com 2005-06-10 04:35 pm (UTC)(link)
Couldn't you just have changed all the instances of 40 and 41 to ARBITRARY_CONSTANT_NAME and ARBITRARY_CONSTANT_NAME_2?

[identity profile] zane314.livejournal.com 2005-06-11 07:08 am (UTC)(link)
What's wrong with ?:?

[identity profile] fabricant.livejournal.com 2005-06-11 11:27 pm (UTC)(link)
Nothing wrong with it in principle, it's just frequently overused/improperly used. At least that's how I remember O'Neill describing it when I took CS70.