76 ms·
What is the best comment in source code you have ever encountered?
- drewse 16y agoMaybe something like this... //How's my coding? //1-800-NO-ONE-CARES Although I had trouble coming up with what to say in the phone number. Any suggestions?
- byoung2 16y agoFrom an educational app: if($_GET["action"] == "score") {//that's what she said
- heseltine 16y agoThis one: http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered/184673#184673 http://stackoverflow.com/questions/184618/what-is-the-best-c...
- Scott_MacGregor 16y agoGood funny post, that was the best laugh I've had all day. Thanks!
- ScottBurson 16y agoIn a parser for a config file: if (line[0] == '#') continue; // comment
- kraynar 16y agoThere's some great stuff in there. I really liked this one: // somedev1 - 6/7/02 Adding temporary tracking of Login screen // somedev2 - 5/22/07 Temporary my ass (http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered/778275#778275 http://stackoverflow.com/questions/184618/what-is-the-best-c...)
- neilc 16y agoNot to be a grouch, but most of this seems puerile and borderline irresponsible to me. Source code should be concise and beautiful, not a repository for unfunny attempts at humor by programmers.
- jsvaughan 16y agoI agree.
- VladRussian 16y agoseems to be a good place to get "-4" karma
- dlnovell 16y agoYou must be delightful to work on a team with
- Calamitous 16y ago// I have to put this part in because Ken is a dick
- jacobbijani 16y ago#Christmas tree initializer toConnect = [] toRead = [ ] toWrite = [ ] primes = [ ] responses = {} remaining = {} http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered/780361#780361 http://stackoverflow.com/questions/184618/what-is-the-best-c...
- DiabloD3 16y agoYou just obliterated like 3 hours of my time. Good job!
- deleted 16y ago[deleted]
- statictype 16y agochar program [1];/* Unwarranted chumminess with compiler. */ First by Dennis Ritchie in his regular expression implementation, and then subsequently copied with the comment intact into all other regular expression implementations ever written.
- Jach 16y agoReference for non-C hackers: http://c-faq.com/struct/structhack.html http://c-faq.com/struct/structhack.html
- aaronbrethorst 16y agoHere's a category interface in a shipping iPhone app of mine: @interface UIScreen (AppleAreAssholes) + (CGRect) convertRect:(CGRect)rect toView:(UIView *)view; @end
- neilk 16y agohttp://www.flickr.com/photos/straup/2801691670/ http://www.flickr.com/photos/straup/2801691670/
- christefano 16y agostop(); // Hammertime!
- jackdaniels 16y agoI love it! :) The best one so far! I'm still laughing my ass off!
- m0nty 16y ago"This ain't pretty but neither are you."
- 10ren 16y agoI hate the way SO only remembers you for a week or two, so when you return, you have to login, going to a separate screen and so on. Why do they have to make it so hard? What's the advantage in forcing frequent logins? Yeah, I know I should find some other StackExchange site, go there, create an account there, login there, and post this complaint there - but you know, that's just more of the same problem. </rant>
- codinghorror 16y agoEr.. what? We can't reproduce this, and there are sites in the network I don't visit very often, too. Please note we did force logout globally, network-wide in April 2010 (to mandate emails for Google GMail OpenIDs) and September 10th 2010 (to enable global auth for all users). Also, we delete any sessions older than 4 months as a matter of course. So if you visit VERY infrequently, you might run into one of those. Details: http://blog.stackoverflow.com/2010/04/openid-one-year-later/ http://blog.stackoverflow.com/2010/04/openid-one-year-later/ http://blog.stackoverflow.com/2010/09/global-network-auto-login/ http://blog.stackoverflow.com/2010/09/global-network-auto-lo...
- felideon 16y agoYes, and when you log in it "forgets" where you wanted to go in the first place. (They may have fixed this recently, but it was like that for the longest time.)
- zyfo 16y agoFor a puzzled second there I thought you referred SO to significant other. I thought I was reading some obscure head-in-the-code-24/7 programmer joke.
- rquirk 16y agoThere was a recent forced logout on all stack* sites due to changes in the way cookies are handled. If you haven't visited in a while, that could be the cause of it.
- nivertech 16y ago/** * Today I'm getting discharged from the Army * Don't have time to properly comment the code * Call me if you have any questions: Name,054-XXXXXXX */
- run4yourlives 16y agoNow that is dedication!
- pmichaud 16y agoI once wrote a haiku to a particularly nasty bug where the offending line had been. I got a call years later when someone found it, they appreciated the humor.
- edanm 16y agoThere are lost of great ones. I especially liked this practical comment: From the SO answer: This seems to stop morons from messing my code... // Autogenerated, do not edit. All changes will be undone. http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered/740603#740603 http://stackoverflow.com/questions/184618/what-is-the-best-c...
- kd0amg 16y agoThen someone who's perhaps a bit too clever for his own good can introduce a new script into the build process so it makes some changes after the file is generated.
- edw519 16y agoloop ... ... // sleep 10 sleep 7 // Changed from "sleep 10" on 11-19-05 // by jvj because Bruce in Buffalo bitched // that it ran too long. Now he's happy. // The next time he bitches, change it to // "sleep 5". That oughta buy us another // year before we have to rewrite it. ... ... until done do repeat
- jeebusroxors 16y agoThe speed up loop: http://thedailywtf.com/Articles/The-Speedup-Loop.aspx http://thedailywtf.com/Articles/The-Speedup-Loop.aspx Although I guess the punchline has come before the "joke"...
- tariq 16y ago# Do this twice because its stupid and won't work once # I apologize for how messy this is. Blame it on an inconsistent database structure. I did the best I could.
- amalcon 16y ago// I got this code from [Bob] of [Some other group]. // I don't know how it works; ask him. [Bob] happened to be my manager at the time, and hadn't worked for [Some other group] for around five years.
- jacquesm 16y ago/* Does your mother know you're reading this stuff? */
- jrockway 16y agoYou are not expected to understand this.
- waivej 16y agowhile (6!=9) // Hendrix loop {...}
- Vivtek 16y agoMy favorite of all time was // Michael, this is brilliant! Yeah, somebody else had complimented a change I'd made a few months earlier. I still maintain that code occasionally, and it's the only comment left I didn't write myself. I leave it there just to get that little ego boost every couple of years.
- GBKS 16y ago// Don't even ask Found years ago in Adobe's ActionScript core classes.
- nw 16y agoI once left a comment to the effect of // This code is pretty dense so I recommend you read the documentation first Some months later I found a follow-up comment left by a fellow dev: // Or you could just give up now
- carlos 16y agothe best comment is the empty one ;) //
- superk 16y agohttp://www.dillerdesign.com/experiment/DD_belatedPNG/ http://www.dillerdesign.com/experiment/DD_belatedPNG/ (a PNG-fix for IE6) // PLEASE READ: // Absolutely everything in this script is SILLY. I know this. IE's rendering of certain pixels doesn't make sense, so neither does this code!
- superk 16y agohttp://textpattern.googlecode.com/svn/releases/4.2.0/source/textpattern/publish.php http://textpattern.googlecode.com/svn/releases/4.2.0/source/... $html = parse($html); // the function so nice, he ran it twice
- ghotli 16y agotry { ... } catch exception { // Failed to load in the proper way // Attempting to wing it ... }
- deleted 16y ago[deleted]
- osopoderoso 16y ago""" This code will be documented when someone get convinced that it is impossible to understand what it is doing """
- deleted 16y ago[deleted]
- gcv 16y agoFrom xterm's main.c: /* * W A R N I N G * * If you think you know what all of this code is doing, you are * probably very mistaken. There be serious and nasty dragons here. */