Log in

No account? Create an account
color cycle (slow)

Kistaro Windrider, Reptillian Situation Assessor

Unfortunately, I Really Am That Nerdy

Previous Entry Share Next Entry
Code Comedy
color cycle (slow)
Comments in my CS 241 programming assignment can be rather comical when taken out of the context of what I'm building. Anybody have any guesses as to what

//Preincrement critical. Extracted stomped

is actually a comment about?

  • 1
A guess, given no context:

Increment one variable, some kind of critical counter, and decrement or reset to zero another variable that contained or counted some kind of extracted data.

As an old-time system programmer on IBM mainframes, I've seen much worse. Remember though that if you ever write code that might actually have to be patched or maintained by someone else, the someone else is probably not as smart as you are. So in that context, best to make the comments very clear.

Keep up the good work.


Within context, it's actually pretty obvious what I'm doing- but without it, it's amusing. This is part of a binary heap; I'm writing into the main storage array. I have to preincrement my lastElement counter (for how large the array actually is), but then I put right into that location; without the preincrement, I'd just overwrite the last element. Now that element after the last one is used as convinient temporary storage for a different operation; it gets overwritten at this point. It doesn't matter- that data there is only viewed during that other method- but it's better to note it, even if it does come out a bit cryptic because I'm fighting the 80-column line limit as I'd rather not spill the comment onto a second line if I can avoid it.

  • 1