Epic Code Comments /*LOL*/

Sometimes in your usual tester or developer life, you have to handle with code to see what’s happening. Sometimes, you find some clues thanks to the comments. Sometimes, you know you are facing an impossible mission, also thanks to the comments. There are tons of samples around the web, so we are going to do a first compilation of the funniest ones!

code_comments_bug_feedback_report

Literature, music & cinema

// Abandon all hope, ye who enter here.

options.BatchSize = 300; // Madness? THIS IS SPARTA!

long long ago; /* in a galaxy far far away */

long john; // silver

mov si, pCard ; captain?

// batmon.c drives the rastamobile

// TODO: Matt Damon

// The truth is not out there. It is here
#define TRUE (1==1)
#define FALSE (!TRUE)

// Too much log will kill you

// This is a kind of magic…

Honestity first

// below here be scary parsing related things

// Incoming on the ROUTE_RUP
// I wrote this while I was tired. Forgive me.

// This is a stupid class that I wrote under duress.
// I apologize to all affected.

// I am not responsible of this code.
// They made me write it, against my will.

// Dear future me. Please forgive me.
// I can’t even begin to express how sorry I am.

// This code sucks, you know it and I know it.
// Move on and call me an idiot later.

// TODO: this is obviously not right … this whole
// fucking module sucks anyway

// This job would be great if it wasn’t for the
// fucking customers.

// 2,191 lines of complete and utter shit coming up…

// BEGIN HACK

// END HACK: I feel dirty.

// Notice: I feel so dirty doing this, but it’s the
// only way to make it cross browser.

Creative

// Hocus Pocus, grab the focus
winSetFocus(…)

public boolean isDirty() {
// why do you always go out and
    return dirty;
}

raise InvalidChild() # e.g. no legs

gotoAndPlay(84112); //W/ Yours, asshole. Stay away from mine!

// Times New Roman? What was wrong with the old Romans?

} catch (PartInitException pie) {
// Mmm… pie
}

double penetration; // ouch

# Christmas tree initializer
toConnect = []
toRead =   [  ]
toWrite = [    ]
primes = [      ]
responses = {}
remaining = {}

doRun.run(); // … “a doo run run”.

virgin = 0; /* you’re not a virgin anymore, sweety */

/* Array where widgets live. Should have been called WidgetLand? */
tWidget Widgets[MAX_WIDGETS];

//        .==.        .==.
//       //`^\\      //^`\\
//      // ^ ^\(\__/)/^ ^^\\
//     //^ ^^ ^/6  6\ ^^ ^ \\
//    //^ ^^ ^/( .. )\^ ^ ^ \\
//   // ^^ ^/\| v”"v |/\^ ^ ^\\
//  // ^^/\/ /  `~~`  \ \/\^ ^\\
//  —————————–
/// HERE BE DRAGONS

Religion

ABORT Routine
. . First things first, get rid of all trap conditions.
trapclr all
. . Now, KILL FOR KALI!!!!!
chain “zyxvutsrqonm”
return

/* “seek and ye shall find”… praying never hurts either… ggg sacrafices another 710 to the computer gods. */

// I will give you two of my seventy-two virgins if you can fix this.

// For the sins I am about to commit, may James Gosling forgive me

last = first; /* Biblical reference */

// Be a real daemon: fork myself and kill my parent

// This code makes baby Jesus very sad!

// A Gorgon class – For the love of Zeus don’t look directly
// at it!

You’re doing it wrong

// Sometimes I believe compiler ignores all my comments

return null; // Not really null

return 1; # returns 1

/* Always returns true */
public boolean isAvailable() {
return false;
}

/* FOR CLASS INTERNAL USE ONLY */
public void someMethod() {

}

case LEFT_KEY_PRESS:
// Shouldn’t ever happen… so close display if it does

// In case we get totally confused
virtual SHORT DoUnknownCommand( Command *cmd );

// I am not sure why this works but it fixes the problem.

#define TRUE FALSE //Happy debugging suckers

// I can’t divide with zero, so I have to divide with
// something very similar
result = number / 0.00000000000001;

// This break at random times.
int numUnits = Integer.parseInt(request.getParam(“num_pieces”));
// Same as above.
float price = Float.parseFloat(request.getParam(“price”));
// Under certain conditions the following code blows up.
// I don’t know those conditions.
float pricePerUnit = price / (float)numUnits;

// I am not sure if we need this, but too scared to delete.

Love is in the air

/* Project : XYZ (Please somebody shoot me!)
*
* File : $Id: defs.h,v 1.1 $
*
* Purpose : Create havoc rather than peace among many nations
*
* History : Back-ported changes that were not in CVS. Please
* somebody, shoot us and put us all out of our misery.
*/

// Uncomment the following line if the program manager
// changes her mind again this week.

// if i ever see this again i’m going to start bringing guns
// to work

//
// Dear maintainer:
//
// Once you are done trying to ‘optimize’ this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
//
// total_hours_wasted_here = 16
//

// John! If you’ll svn remove this once more,
// I’ll shut you, for God’s sake!
// That piece of code is not “something strange”!
// That is THE AUTH VALIDATION.

// This only exists because Scott doesn’t know how to use
// const correctly.

/* We will NOT put a fucking timestamp in the header here. Every time you put it back, I will come in and take it out again. */

/* None of this shit works, because whatever you set the current document to MS override it with a derived name, and since the CWinApp class can’t even ask what it’s own fucking document pointer is without doing a hundred lines of shit deep within MFC then I’m going to fuck the whole lot off by storing a pointer which I can then use later in the CWinApp class to override the doc name. All this fucking bollocks was because MS insist on doing their own switch-comparing so I can’t pass in ‘real’ switches, I have to use this ‘#’ crap. Stupid fucking incompetent MS dickheads. Like how hard would it be to pass command line switches to the app instead of just filenames? */

My favourite one of this block deserves an own section:

/* At this point, I’d like to take a moment to speak to you about the Adobe PSD format. PSD is not a good format. PSD is not even a bad format. Calling it such would be an insult to other bad formats, such as PCX or JPEG. No, PSD is an abysmal format. Having worked on this code for several weeks now, my hate for PSD has grown to a raging fire that burns with the fierce passion of a million suns.
If there are two different ways of doing something, PSD will do both, in different places. It will then make up three more ways no sane human would think of, and do those too. PSD makes inconsistency an art form. Why, for instance, did it suddenly decide that *these* particular chunks should be aligned to four bytes, and that this alignment should *not* be included in the size? Other chunks in other places are either unaligned, or aligned with the alignment included in the size. Here, though, it is not included. Either one of these three behaviours would be fine. A sane format would pick one. PSD, of course, uses all three, and more.
Trying to get data out of a PSD file is like trying to find something in the attic of your eccentric old uncle who died in a freak freshwater shark attack on his 58th birthday. That last detail may not be important for the purposes of the simile, but at this point I am spending a lot of time imagining amusing fates for the people responsible for this Rube Goldberg of a file format.
Earlier, I tried to get a hold of the latest specs for the PSD file format. To do this, I had to apply to them for permission to apply to them to have them consider sending me this sacred tome. This would have involved faxing them a copy of some document or other, probably signed in blood. I can only imagine that they make this process so difficult because they are intensely ashamed of having created this abomination. I was naturally not gullible enough to go through with this procedure, but if I had done so, I would have printed out every single page of the spec, and set them all on fire. Were it within my power, I would gather every single copy of those specs, and launch them on a spaceship directly into the sun.
PSD is not my favourite file format. */

ACHTUNG!

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// !! IF YOU CHANGE TABS TO SPACES, YOU WILL BE KILLED !!
// !!!!!!!! DOING SO FUCKS THE BUILD PROCESS !!!!!!!!!!!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

; Do not change the following line.
SmplCInputCue1=gwfreq
; You better not have changed it!

/*******************************************************/
// Deep wizardry. Do not touch.
// No seriously. XXXXXX I’m looking at you. If you
// screw with this again I will kill you with my
// swingline stapler.
/*******************************************************/

/* Ad Index scheming and plotting – Those with heart conditions are advised to not continue */

// Bits 6, 5, and 4 must be 0, 1, and 0 respectively.
// Otherwise, the oscillator burns crazy evil crack.

// If filename is more than 1000 characters long, we die a
// horrible death. Sorry.

Unix System V/286 bootstrap:
mov $di, 0
;; never trust a micro

// Magic. Do not touch.

// (c) 2000 Applied Magic, Inc.
/* Unauthorized use punishable by torture, mutilation, and vivisection. */

Procrastinating

# Boy, we’re not built for extensibility, I guess. Someday,
# I’ll clean all of the things like this up.

/* Horrible horrible leprous kludge! High criticality, very high priority bug that would need major restructuring to fix properly.
PLEASE PLEASE PLEASE don’t let this become permanent! PLEASE let us do a proper job of it soon! */

/* This routine is intentionally poorly documented for security purposes. */

// somedev1 – 6/7/02 Adding temporary tracking of Logic screen
// somedev2 – 5/22/07 Temporary my ass

// Catching exceptions is for communists

/* FIXME: please god, when will the hurting stop? Thus function is so fucking broken it’s not even funny. */

// This comment is self explanatory.

__inline BOOL
SearchOneDirectory(
IN LPSTR Directory,
IN LPSTR FileToFind,
IN LPSTR SourceFullName,
IN LPSTR SourceFilePart,
OUT PBOOL FoundInTree
)
{

// This was way too slow. Just say we didn’t find
// the file.
*FoundInTree = FALSE;
return(TRUE);
}

Bonus track. The worse one:

// TODO make this work

 

We hope you liked it. Which are the weirdest comments have you found on your daily life? You can find much more on this links:
http://c2.com/cgi/wiki?FunnyThingsSeenInSourceCodeAndDocumentation
http://myfootprintz.blogspot.com.es/2011/06/1-2-3-4-5-6-7-8-9-10-11-12-13-14-ok.html
http://www.geek.com/geek-cetera/best-code-comments-ever-1286185/
http://www.reddit.com/r/gaming/comments/1bnm6r
http://www.reddit.com/r/programming/comments/1bnezw
http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered

Leave a Reply