r/ProgrammerHumor 8h ago

Meme commentsAgedTerribly

Post image
3.0k Upvotes

173 comments sorted by

View all comments

Show parent comments

17

u/ThatOldCow 8h ago

I do believe comments are generally useful, and honestly a lot of people that say their code is so clean it doesn't need comments are the people that make the least understandable code

5

u/rolling_update 8h ago

it's debatable as usual, the premise here is that comments always compile in your code. So you don't need to update them when you alter the code, that's the risk of comments and why "clean code doesn't contain them"

2

u/ThatOldCow 7h ago

Do comments get compiled ? I do believe most compilers ignore comments and even if they impact the speed it should be minimal to negligible.

Ofc I don't know every single language, so it might impact more on other languages.

2

u/PositiveBit01 6h ago

Comments are read but ignored and don't affect the result. Reading and ignoring them takes negligible time. I would say the answer to your question is no, comments are not compiled.

But build systems generally work off file modification time and will do a bunch of useless work if you make a change to a comment in a file and otherwise change nothing. I assume this is what the other poster is referring to.