32+ funny Code Comments that people actually wrote

Well, This writing will show you how code commenting can be funny too. I have listed some funny code comments people encountered in production code. Note: If you want to learn more about JavaScript…

ByXOR

image

Photo by Arnold Francisca on Unsplash

Code Commenting! Some people say it’s ugly , Some says it’s standard and good practice to do. Commenting is the “art” of describing what your program is going to do in “high level” English statements. Well, This writing will show you how code commenting can be funny too. I have listed some funny code comments people encountered in production code. Note: If you want to learn more about JavaScript, head over to VentureLessons for recommendations for the best online programming courses. TL;DR Noting serious here ! Read this just for fun !

//The below code needs to be commented out.
// Weed Effect !
// thread the hand the query waiting.
// Don't put an assertion here; there are enough assertions in the
// schema processor to kill a horse already.
return this; // todo
// 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.
// We don't really need to do this, as the environment will keep track
// of it and clean up for us. But we're tidy Kiwis round here, aren't we?
# -- #perl was here! --
# <Skrewtape> Larry Wall is a lot sexier than Richard Stallman
# <Skrewtape> But I've heard Stallman is better in bed.
# <Schwern> Does he leave the halo on?
# * aether c*cks her head at skrew...uh...whatever?
# <fimmtiu> Stallman's beard is a sex magnet.
# <Skrewtape> Larry's moustache is moreso, Fimm.
# <aether> oh yeah...women all over the world are hot for stallman....
# <Skrewtape> Moustaches make my heart melt.
# <Schwern> I dunno, there's something about a man in hawaiian shirts...
# Tkil's gonna love this one. :-) But what the hell... it's safe to
# assume that the only thing initiating DCCs will be Connections, #right? Boy, we're not built for extensibility, I guess. Someday, #I'll clean all of the things like this up.
# Ye Olde Contructor Methode. You know the drill. # Takes absolutely # no args whatsoever.
/* Project : XYZ (Please somebody shoot me!)
// I never trust internal program documentation
// Yesterday I had a scare,
// I ran some code that wasn't there,
//  It wasn't there again today;
//  Oh, how I wish that it would stay.
// Either the app is exiting or the world is coming to an end.
// Take your pick.
// User has no right toe
// This is a stupid class that I wrote under duress. I apologize to // all affected.
public boolean isDirty() {
	// why do you always go out and
	return dirty;
}
// The following was stolen in large part from MSDN by (name) & I.
// I tried to give it back, but they wouldn't take it.
// I don't blame them...
// according to the Win98 docs, this should be 1// according to the WinNT docs, this should be 2// they are both wrong!
// according to the Win98 docs, this should be 1// according to the WinNT docs, this should be 2// they are both wrong!
// according to the Win98 docs, this should be 1// according to the WinNT docs, this should be 2// they are both wrong!
// Abandon all hope, ye who enter here.

//The following code was written by <developer name>.
// Unless it doesn't work, then I have no idea who wrote it.
// Ad Index scheming and plotting - Those with
 //	heart conditions are advised to not continue
// nobody read comments!
i++; //increment i
  // Since this file is loaded on every page, and since
  // I want the following function on every page, I'm going to
  // cheat and include it here even though it has nothing to
  // do with the other things in this file.
  // If you don't like it, bite me!
return 1; # returns 1
// Hocus Pocus, grab the focus
return null; //Not really null
//if nothing else can be found to run, will go feed the ducks.
// below here be scary parsing related things
// Magic. Do not touch.
// sometimes I believe compiler ignores all my comments
// I dedicate all this code, all my work, to my wife, Darlene, who //will have to support me and our three children and the dog once it //gets released into the public.
// I am not responsible of this code.
// They made me write it, against my will.
//
// 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 = 42
# To understand recursion, see the bottom of this fileAt the bottom of the file# To understand recursion, see the top of this file
# To understand recursion, see the bottom of this fileAt the bottom of the file# To understand recursion, see the top of this file
# To understand recursion, see the bottom of this fileAt the bottom of the file# To understand recursion, see the top of this file
// I will give you two of my seventy-two virgins if you can fix this.
//Dear future me. Please forgive me.
//I can't even begin to express how sorry I am.
//private instance variable for storing age
public static int age;
#define TRUE FALSE
//Happy debugging suckers
//open lid

//take sh*t

//close lidComments for a File open, data dump, file close…
//open lid

//take sh*t

//close lidComments for a File open, data dump, file close…
const int TEN=10; // As if the value of 10 will fluctuate...
/* You are not meant to understand this */
/*
* TODO: Remove this function

function remove($customer_id)
    {
        $this->Customer->remove($id);
    }

*/
//When I wrote this, only God and I understood what I was doing
//Now, God only knows
// drunk, fix later
// I'm sorry.
//This code sucks, you know it and I know it.
// I am not responsible of this code.
/* Please work */
// I have to find a better job
// Joe is sorryA few hundred lines later...
// Harry is sorry too
// Joe is sorryA few hundred lines later...
// Harry is sorry too
#Christmas tree initializer
    toConnect = []
    toRead =   [  ]
    toWrite = [    ]
    primes = [      ]
    responses = {}
    remaining = {}
Catch (Exception e) {
 //who cares?
}
// Remove this if you wanna be fired
// somedev1 -  6/7/02 Adding temporary tracking of Login screen
// somedev2 -  5/22/07 Temporary my ass
// IE7 update. this is still bad code, but IE8 is probably a long way off :)
// no comments for you
// it was hard to write
// so it should be hard to read
// If this code works, it was written by Paul DiLascia. If not, I don't know
// who wrote it
// This comment is self explanatory.
int main(void)
/* Program starts here */
} catch (PartInitException pie) {
    // Mmm... pie
// Houston, we have a problem
// I am not sure if we need this, but too scared to delete.
// If this comment is removed the program will blow up
//This code sucks, you know it and I know it.
//Move on and call me an idiot later.
/**
 * Always returns true.
 */
public boolean isAvailable() {
    return false;
}
// Autogenerated, do not edit. All changes will be undone.
// hack for ie browser (assuming that ie is a browser)
// Joe is sorry
Few Hundred Lines Later
// Harry is sorry too
double penetration; // ouch
/////////////////////////////////////// this is a well commented line
Exception up = new Exception("Something is really wrong.");
throw up;  //ha ha
//Mr. Compiler, please do not read this.
// TODO - Comment this function
// All bugs added by David S. Miller
//If you're reading this, then my program is probably a success
Catch (Exception e) {
    //eat it
}
Repeat
    ...
Until (JesusChristsReturn) // Not sure
// This should fix something that should never happen
//todo: never to be implemented
//I am not sure why this works but it fixes the problem.
// somedev1 -  6/7/02 Adding temporary tracking of Login screen
// somedev2 -  5/22/07 Temporary my ass
/**
* For the brave souls who get this far: You are the chosen ones,
* the valiant knights of programming who toil away, without rest,
* fixing our most awful code. To you, true saviors, kings of men,
* I say this: never gonna give you up, never gonna let you down,
* never gonna run around and desert you. Never gonna make you cry,
* never gonna say goodbye. Never gonna tell a lie and hurt you.
*/
// simply copied from another code
//This is a kind of magic.
//Please comment on your source code
int MyFunction()
{
    // There once was a man named Dave
    int Result = 0;

    // Whose code just wouldn't behave
    MyObject *Ptr = new MyObject();

    // He left to go to a meetin'
    Result = Ptr->DoSomething();

    // And left his memory a leakin'
    return Result;
}
//
//3.4  JeK  My manager promised me a lap dance if I can fix this release
//3.5  JeK  Still waiting for that dance from my manager
//3.6  JeK  My manager got changed, the new manager is hairy, dont want the dance anymore
//3.7  Jek  Got that dance, yuck!
//
public boolean isDirty() {
    //Why do you always go out and
    return dirty;
}
# as you can see: I comment the code!
// TODO: Finish.
/*
after hours of consulting the tome of google
i have discovered that by the will of unknown forces
without the below line, IE7 believes that 6px = 12px
*/
font-size: 0px;
public GetRandomNumber()
{
    // Chosen by a fairly rolen dice
    return 12;
}
// This function has been here since 1987. DON'T FXXKING TOUCH IT
// *** drunk -- fix later ***
// TODO: Delete
// if i ever see this again i'm going to start bringing guns to work
// For the sins I am about to commit, may James Gosling forgive me
def format_ticket_content(text, recursive = true)
  if text.is_a?(TicketNote)
    note = text
    text = note.content
  else
    note = nil
  end

  ## Safety pig has arrived!
  text = h(text)
  ##                               _
  ##  _._ _..._ .-',     _.._(`))
  ## '-. `     '  /-._.-'    ',/
  ##    )         \            '.
  ##   / _    _    |             \
  ##  |  a    a    /              |
  ##  \   .-.                     ;
  ##   '-('' ).-'       ,'       ;
  ##      '-;           |      .'
  ##         \           \    /
  ##         | 7  .__  _.-\   \
  ##         | |  |  ``/  /`  /
  ##        /,_|  |   /,_/   /
  ##           /,_/      '`-'
  ##
//I'm sorry, but our princess is in another castle.
long long ago; /* in a galaxy far far away */
<!-- Here be dragons  -->
try {

} finally { // should never happen

}
/*
 * You may think you know what the following code does.
 * But you dont. Trust me.
 * Fiddle with it, and youll spend many a sleepless
 * night cursing the moment you thought youd be clever
 * enough to "optimize" the code below.
 * Now close this file and go play with something else.
 */
// Replaces with spaces the braces in cases where braces in places //cause stasis
   $str = str_replace(array("\{","\}")," ",$str);
/* Ah ah ah! You'll never understand why this one works. */
// This only exists because Scott doesn't know how to use const //correctly
// All this code is yours, except gedit()...attempt no modifications //there.
//If you even THINK of changing this code, you may have already gone //too far
else
{
    // wobbly wilson said this would *never* happen!!
}
//this formula is right, work out the math yourself if you don't believe me
/*
 *  'schedule()' is the scheduler function. It's a very simple and nice
 * scheduler: it's not perfect, but certainly works for most things.
 * The one thing you might take a look at is the signal-handler code here.
 *
 *   NOTE!!  Task 0 is the 'idle' task, which gets called when no other
 * tasks can run. It can not be killed, and it cannot sleep. The 'state'
 * information in task[0] is never used.
 *
 * The "confuse_gcc" goto is used only to get better assembly code..
 * Dijkstra probably hates me.
 */
asmlinkage void schedule(void)
stop(); // Hammertime!
//This was clearly written under duress
// Abandon all hope you who needs to debug this
doRun.run();  // ... "a doo run run".
// Whoever put this here is an idiot…this doesn’t work at all !
// TODO make this work

                                   .='  ' .`/,/!(=)Zm.
                     .._,,._..  ,-`- `,\ ` -` -`\\7//WW.
                ,v=~/.-,-\- -!|V-s.)iT-|s|\-.'   `///mK%.
              v!`i!-.e]-g`bT/i(/[=.Z/m)K(YNYi..   /-]i44M.
            v`/,`|v]-DvLcfZ/eV/iDLN\D/ZK@%8W[Z..   `/d!Z8m
           //,c\(2(X/NYNY8]ZZ/bZd\()/\7WY%WKKW)   -'|(][%4.
         ,\\i\c(e)WX@WKKZKDKWMZ8(b5/ZK8]Z7%ffVM,   -.Y!bNMi
         /-iit5N)KWG%%8%%%%W8%ZWM(8YZvD)XN(@.  [   \]!/GXW[
        / ))G8\NMN%W%%%%%%%%%%8KK@WZKYK*ZG5KMi,-   vi[NZGM[
       i\!(44Y8K%8%%%**~YZYZ@%%%%%4KWZ/PKN)ZDZ7   c=//WZK%!
      ,\v\YtMZW8W%%f`,`.t/bNZZK%%W%%ZXb*K(K5DZ   -c\\/KM48
      -|c5PbM4DDW%f  v./c\[tMY8W%PMW%D@KW)Gbf   -/(=ZZKM8[
      2(N8YXWK85@K   -'c|K4/KKK%@  V%@@WD8e~  .//ct)8ZK%8`
      =)b%]Nd)@KM[  !'\cG!iWYK%%|   !M@KZf    -c\))ZDKW%`
      YYKWZGNM4/Pb  '-VscP4]b@W%     'Mf`   -L\///KM(%W!
      !KKW4ZK/W7)Z. '/cttbY)DKW%     -`  .',\v)K(5KW%%f
      'W)KWKZZg)Z2/,!/L(-DYYb54%  ,,`, -\-/v(((KK5WW%f
       \M4NDDKZZ(e!/\7vNTtZd)8\Mi!\-,-/i-v((tKNGN%W%%
       'M8M88(Zd))///((|D\tDY\\KK-`/-i(=)KtNNN@W%%%@%[
        !8%@KW5KKN4///s(\Pd!ROBY8/=2(/4ZdzKD%K%%%M8@%%
         '%%%W%dGNtPK(c\/2\[Z(ttNYZ2NZW8W8K%%%%YKM%M%%.
           *%%W%GW5@/%!e]_tZdY()v)ZXMZW%W%%%*5Y]K%ZK%8[
            '*%%%%8%8WK\)[/ZmZ/Zi]!/M%%%%@f\ \Y/NNMK%%!
              'VM%%%%W%WN5Z/Gt5/b)((cV@f`  - |cZbMKW%%|
                 'V*M%%%WZ/ZG\t5((+)L\'-,,/  -)X(NWW%%
                      `~`MZ/DZGNZG5(((\,    ,t\\Z)KW%@
                         'M8K%8GN8\5(5///]i!v\K)85W%%f
                           YWWKKKKWZ8G54X/GGMeK@WM8%@
                            !M8%8%48WG@KWYbW%WWW%%%@
                              VM%WKWK%8K%%8WWWW%%%@`
                                ~*%%%%%%W%%%%%%%@~
                                   ~*MM%%%%%%@f`
                                       '''''
//  If you delete the credits, I will f**king kill you.
/************************************************************
        *                                                           *
        *  .=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.       *
        *   |                     ______                     |      *
        *   |                  .-"      "-.                  |      *
        *   |                 /            \                 |      *
        *   |     _          |              |          _     |      *
        *   |    ( \         |,  .-.  .-.  ,|         / )    |      *
        *   |     > "=._     | )(__/  \__)( |     _.=" <     |      *
        *   |    (_/"=._"=._ |/     /\     \| _.="_.="\_)    |      *
        *   |           "=._"(_     ^^     _)"_.="           |      *
        *   |               "=\__|IIIIII|__/="               |      *
        *   |              _.="| \IIIIII/ |"=._              |      *
        *   |    _     _.="_.="\          /"=._"=._     _    |      *
        *   |   ( \_.="_.="     `--------`     "=._"=._/ )   |      *
        *   |    > _.="                            "=._ <    |      *
        *   |   (_/                                    \_)   |      *
        *   |                                                |      *
        *   '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='      *
        *                                                           *
        *      LASCIATE OGNI SPERANZA, VOI CH'ENTRATE               *              LEAVE EVERY HOPE, YOU COME IN
        *************************************************************/
// If I from the future read this I'll back in time and kill myself.
// TODO: Fix this.  Fix what?
/*
This isn't the right way to deal with this, but today is my last day, Ron
just spilled coffee on my desk, and I'm hungry, so this will have to do...
*/

return 12; // 12 is my lucky number
using namespace std;            // So sue me
/*
* Wirzenius wrote this portably, Torvalds f**ked it up :-)
*/
/*
* After 36 hours, 2 holes in my wall and writing my code right beside the API
* this still doesn't work.
* function getMap():void takes in an event object @param: evt:mouseEvent
* I will now retire for the day with a bottle of rum and 2 hours of crying
*/
/* Here I sit, Joe broken hearted, came to do some sh*t, but only just started. */
// Catching exceptions is for communists
//Mind boggling, gibberish version of a SQL statement, but it //work's, so dont touch it
catch (Ex as Exception)
{
     // oh crap, we should do something.
}
// set break point here - you'll never reach it
return 0; // Happy ending
//-- Beyond this point, there'll be dragons
//The below code needs to be commented out.
// TODO: end this lunacy
//This condition can't happen. Call the police or something.
//DON'T TOUCH THIS SCRIPT -> XSLT is like arcane, black magic
//I don't understand how the following bit works, but it worked in //the program I stole it from.
//this used to be a comment
/* Every time I re-visit this function, I feel like
 * I need to take a shower.
 *
 * Don't get too used to this function, its days are
 * numbered.
 */
// IE7 update. this is still bad code, but IE8 is probably a long way off :)
// TODO: not this

// This is confusing, I KNOW, so let me explain it to you.

//        .==.        .==.
//       //`^\\      //^`\\
//      // ^ ^\(\__/)/^ ^^\\
//     //^ ^^ ^/6  6\ ^^ ^ \\
//    //^ ^^ ^/( .. )\^ ^ ^ \\
//   // ^^ ^/\| v""v |/\^ ^ ^\\
//  // ^^/\/ /  `~~`  \ \/\^ ^\\
//  -----------------------------
/// HERE BE DRAGONS
// This is crap code but it's 3 a.m. and I need to get this working.
// I from the future read this I'll back in time and kill myself.
// I'm not sure what I did
// remove this if you wanna be fired
//too much log will kill you
/*

** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.

*/
# Never edit below this line. Ever. Or I'll kick your ass.
//What is this?
public bool IsReusable
{
    get{return false;}
}
// Any maintenance developer who can't quote entire Monty Python
// movies from memory has no business being a developer.
const string LancelotsFavoriteColor = "$0204FB"
//who ever put this here is an idiot…this doesn’t work at all !
aComment = 'this is not aComment' # this is aComment
class T(object):
    def f(this):
        this is not aComment
// Added because boss changed his mind : 20020111,20020501,20020820, ...
// Commented out because boss changed his mind : 20020201,20020614,20020908, ...
/* Mark: If there's one thing you learn from this code, it is this...
   Never, ever fly Air France.  Their customer service is absolutely
   the worst.  I've never heard the words "That's not my problem" as
   many times as I have from their staff -- It should, without doubt
   be their corporate motto if it isn't already.  Don't bother giving
   them business because you're just a pain in their side and they
   will be sure to let you know the first time you speak to them.

   If you ever want to make me happy just tell me that you, too, will
   never fly Air France again either (in spite of their excellent
   cuisine).

   Update by oej: The merger with KLM has transferred this
   behaviour to KLM as well.
   Don't bother giving them business either...

   Only if you want to travel randomly without luggage, you
   might pick either of them.
   */
/* 2,191 lines of complete and utter shit coming up... */
options.BatchSize = 300; //Madness? THIS IS SPARTA!
if (case1) { // trivial
...
}
else { // we are screwed
 /* fill in later */
}
// some sport psychology
if (!focused)
    Focus();
else
{
    // rien, c'est parfait.
}
var arbitraryNumber = 10;
//I don't know why. Just move on.
// Since this file is loaded on every page, and since
  // I want the following function on every page, I'm going to
  // cheat and include it here even though it has nothing to
  // do with the other things in this file.
  // If you don't like it, bite me!
// Hocus Pocus, grab the focus
  winSetFocus(...)
/* If you think this is a mistake, think again. */
/*
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/
Here is the Second Edition. I hope you will Enjoy that too.🍿

Checkout the actual Stack-overflow question for more like those above. You can add yours top in comments. I will add that in the original Writing later. Thanks for reading. Cheers

Enjoyed this article?

Share it with your network to help others discover it

Continue Learning

Discover more articles on similar topics