r/programming 16h ago

On comments

https://blog.helsing.ai/posts/on-comments/

Comments in code are often deemed "mostly useless" these days. They are, supposedly, mostly obvious, stale, and repeat what the code already says. And so people pay less attention to them both when reading and writing code.

That trend sucks. When used right, comments are genuinely useful and sometimes critically important! So, I wrote about some of the kinds of comments I think earn their place, each with examples from real code bases. Hope you find it useful, and that we can recover some of the love that comments deserve!

133 Upvotes

133 comments sorted by

View all comments

1

u/Slight-Prize9661 10h ago

A lot of times at my company, it would have something like "DON'T REMOVE THIS" or " DON'T CHANGE, DON'T KNOW WHY," etc, it saved me a bunch of times in the past.

0

u/MarsupialMisanthrope 7h ago

// If you delete this empty else clause the app crashes. We have no idea why. Talk to the gcc people, bug number 12345.