this post was submitted on 26 Nov 2023
787 points (99.9% liked)

Programmer Humor

23345 readers
467 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 73 points 2 years ago (3 children)

x += 1; // Increases x by one

[–] [email protected] 61 points 2 years ago* (last edited 2 years ago) (2 children)

// increase the dynamically allocated memory space of a word sized integer stored at the memory address represented by the symbol "x" by the integer 1 and terminate the instruction

[–] [email protected] 37 points 2 years ago (1 children)

Wait why is it dynamically allocated and why are you increasing the memory. Something is very wrong here

[–] [email protected] 33 points 2 years ago (1 children)

Found the bug. Thank goodness for comments.

[–] [email protected] 3 points 2 years ago

Oh, is this what they meant by "commenting your code"?

[–] [email protected] 10 points 2 years ago (1 children)

Why the heck does it need to be dynamically allocated? Just put that puppy on the stack.

[–] [email protected] 6 points 2 years ago

That's what it used to do.
But it was a bug, and the code has been fixed.

[–] [email protected] 20 points 2 years ago* (last edited 2 years ago)

...Years later
x += config.increment; // Increases x by one

"""
config.yaml
increment: -2
"""
[–] [email protected] 16 points 2 years ago (2 children)

x++; // Move X position forward by one

There, I made that kind of comment more useful!

[–] [email protected] 9 points 2 years ago

x++; // Set x to the incrementation of the value of x
Much better.

[–] [email protected] 1 points 1 year ago

// Move to the right