- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
So, what's so bad about the grammatical error?
Admin
I once dealt with a piece of code that implemented a persistent internal database in C++, with pointers and all. It had the following comment:
I didn't even need to touch it to break it -- just changing from a 32-bit architecture to a 64-bit architecture did that all on its own.
Needless to say, when I fixed the code, I removed the comment.
Admin
This made me think of a comment I once saw in production code, saying that the code immediately below didn't work and nobody knew why.
I stared at the body of code for about ten minutes, following the chain of events, and found out why. This revelation was not well received by the people who had produced the code in question.
Admin
mandatory reference:
https://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered
Admin
This comment has leaked into production.
Admin
I miss when Remy used to hide interesting comments in the article source. At least my Cornify bookmarklet still works.
Admin
Just the good old:
and
which, inevitably, get committed and pushed.
Admin
Comments can sometimes lie. Code never does.
Admin
| Comments can sometimes lie. Code never does.
int one=5; int ten=6; int eleven = one + ten; // true
Admin
Shallow copy of object created by a pass-by-value function argument.
Admin
There's your WTF ^^^
Admin
I bet they are ..... Mostly Harmless
Admin
Sounds like someone already took out the dangerous code and left the comment. Or, to quote the Rocky Horror Picture Show, they removed the cause...but NOT the symptom.
Admin
Yeah, people tend to hate it when you fix their mistakes. Corporatism 101.
Admin
Those were probably not the lines that originally followed. As usual, the code was changed but the comments were untouched.
Admin
my favorite comment ever is "this doesn't really do anything anymore". So you took the effort to write the comment, but not to remove the unnecessary code? Great work!
Admin
Those comments exist where the process to make a small change is too unwieldy.
Admin
Or there's insufficient tests/testing to ensure that removal of the "useless code" in fact breaks nothing in that one business-critical component that nobody really understands anymore.
Admin
And then people ask me why I’m against the policy of always putting comments on a separate line.
Admin
I remember a few years ago seeing a comment that went something like: "This code is obsolete. If still here by March 1998, please remove it"
I'm pretty sure the code was commented-out, but it and the comment remained for almost 20 years before I found and removed it.
Admin
Q.E.D.!
Admin
Well, the comment only says to not let the code pass into production, it does not say anything about the comment ...
;)
Admin
Years ago, I ran into a function whose assumed inputs (top N elements of the stack) were documented solely as "you don't want to know", and had to wade through the code to reconstruct what they were (N turned out to be 8 in that instance).
Admin
Complete source code:
// WARNING!!! Special case for [external API] testing. // DO NOT LET THIS PIECE OF CODE FIND IT'S WAY TO PRODUCTION #if development DoSomethingNastyWithApi(); #end if