Advertisement

Funny source code/documentation/comments?

Started by January 16, 2005 10:53 PM
75 comments, last by jonaakey 10 years, 5 months ago
From some of my old code:
SDL_Surface surf = *SDL_LoadBMP("particle.bmp"); // Bad idea
the rug - funpowered.com
my buddy sent me a section of code once that was for a very well known company. Was to the effect of this

// this may need to be looked at?
if X = Y
Z
else
Z


I was rolling for days on this

Advertisement
Quote: Original post by ArchWizard
SDL_Surface* Screen; // Main Screen Turn On


This is the funniest comment I've ever put in my code, which demonstrates quite well how unfunny I really am.
That is the greatest thing of all time.
“[The clergy] believe that any portion of power confided to me, will be exerted in opposition to their schemes. And they believe rightly: for I have sworn upon the altar of God, eternal hostility against every form of tyranny over the mind of man” - Thomas Jefferson
working on a project in software engineering class in java, someone had written this line of code

public void keyPressed(KeyEvent e){
...
textBox.setText(testBox.getText())
...
}

I added a comment directly above the code, just to see if anyone would catch it:

//From sm8236 to td1234: you're fired.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

I think I've posted it here before, but here goes. It's for a relatively large app I made for a company a few years ago

//Here,we close the EXCEL//If we are in 'Print Preview' then we are screwed//It will raise twenty million errors before it hangs completely//The real EXCEL does not let us quit if we are in print preview but//here my application is already half-closed so there is no turning back//It can be fixed,but i'm bored so DONT QUIT WHEN IN PRINT PREVIEW,ASSHOLES!//We will close all open workbooks so excel doesn't bust our balls by asking//if we want to save changes.xlapp.Visible[0]:=FALSE;for i:=1 to xlapp.Workbooks.Count dobeginxlapp.Workbooks.Item[1].Close(False,emptyparam,emptyparam,0);end;xlapp.DisplayStatusBar[0]:=DefShowStatusBar;//Set the statusbar to defaultWindows.SetParent(xlwin,0);//Set the excel window free into the worldDefWinStyle:=DefWinStyle and (not WS_VISIBLE);SetWindowLong(xlwin,GWL_STYLE,DefWinStyle);//Set its style back to normalSetWindowPlacement(xlwin,@DefWinPlacement);//Set its size and position tooXLApp.Quit;//Kill the window and quit EXCELXLApp:=nil;//Free any memory the EXCEL Process has taken//Note:if you are in print preview,FUCK OFF!
some comments on windows(leaked) and linux source code

-windows-
private\windows\media\avi\verinfo.16\verinfo.h:"     *       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!     *       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!     * !!!!!!!IF YOU CHANGE TABS TO SPACES, YOU WILL BE KILLED!!!!!!!     *       !!!!!!!!!!!!!!DOING SO FUCKS THE BUILD PROCESS!!!!!!!!!!!!!!!!     *       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!     *       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "hacks:    private\inet\mshtml\src\core\cdbase\baseprop.cxx:    // HACK! HACK! HACK! (MohanB) In order to fix #64710 at this very late    private\inet\mshtml\src\core\cdutil\genutil.cxx:    // HACK HACK HACK. REMOVE THIS ONCE MARLETT IS AROUND    private\inet\mshtml\src\other\moniker\resprot.cxx:    // <HACK>    goto EndHack;    // </HACK>    private\inet\mshtml\src\site\layout\flowlyt.cxx:    // God, I hate this hack ...    private\inet\wininet\urlcache\cachecfg.cxx:    // Dumb hack for back compat. *sigh*    private\inet\wininet\urlcache\filemgr.cxx:    // ACHTUNG!!! this is a special hack for IBM antivirus software    private\ispu\pkitrust\trustui\acuictl.cpp:    // HACK ALERT, believe it or not there is no way to get the height of the current    // HACK ON TOP OF HACK ALERT,    private\ntos\udfs\devctrl.c:    // Add the hack-o-ramma to fix formats.    private\shell\shdoc401\unicpp\sendto.cpp:    // Mondo hackitude-o-rama.    private\ntos\w32\ntcon\server\link.c:    // HUGE, HUGE hack-o-rama to get NTSD started on this process!    private\ntos\w32\ntuser\client\dlgmgr.c:    // HACK OF DEATH:    private\shell\lib\util.cpp:    // TERRIBLE HORRIBLE NO GOOD VERY BAD HACK    private\ntos\w32\ntuser\client\nt6\user.h:    * The magnitude of this hack compares favorably with that of the national debt. stoned developers:private\shell\ext\tweakui\genthunk.c:* CallProc32W is insane. It's a variadic function that uses* the pascal calling convention. (It probably makes more sense* when you're stoned.)

-linux kernel-

You are not expected to understand this:	/*	 * Switch to stack of the new process and set up	 * his segmentation registers.	 */	retu(rp->p_addr);	sureg();	/*	 * If the new process paused because it was	 * swapped out, set the stack level to the last call	 * to savu(u_ssav).  This means that the return	 * which is executed immediately after the call to aretu	 * actually returns from the last routine which did	 * the savu.	 *	 * You are not expected to understand this.	 */	if(rp->p_flag&SSWAP) {		rp->p_flag =& ~SSWAP;		aretu(u.u_ssav);	}	/*	 * The value returned here has many subtle implications.	 * See the newproc comments.	 */	return(1);happy meal:static void happy_meal_tcvr_write(struct happy_meal *hp,unsigned long tregs, int reg,unsigned short value){int tries = TCVR_WRITE_TRIES;ASD(("happy_meal_tcvr_write: reg=0x%02x value=%04xn", reg,value));/* Welcome to Sun Microsystems, can I take your order please? */if (!hp->happy_flags & HFLAG_FENABLE)return happy_meal_bb_write(hp, tregs, reg, value);/* Would you like fries with that? */hme_write32(hp, tregs + TCVR_FRAME,(FRAME_WRITE | (hp->paddr--crazy errors:linux-2.4.19/drivers/net/wan/dscc4.c:printk(KERN_INFO) "%s: hardware on drugs!\n", dev->name);drivers/usb/printer.c:static char *usblp_messages[] = { "ok", "out of paper", "off-line", "on fire" };arch/sparc64/kernel/traps.c as well as in ../sparc/..        /* Amuse the user. */        printk("              \\|/ ____ \\|/\n""              \"@'/ .. \\`@\"\n""              /_| \\__/ |_\\\n""                 \\__U_/\n");arch/i386/kernel/bluesmoke.c:printk(KERN_EMERG "CPU#%d: Possible thermal failure (CPU on fire ?).\n", smp_processor_id());crazy/shit/f**k/crap stuff:arch/mips/kernel/sysirix.c:/* 2,191 lines of complete and utter shit coming up... */drivers/char/rio/list.h:/*** Will God see it within his heart to forgive us for this thing that** we have created? To remove a packet from the receive queue you clear** its PKT_IN_USE bit, and then bump the pointers. Once the pointers** get to the end, they must be wrapped back to the start.*/arch/sparc64/kernel/process.c:/* fuck me plenty */arch/sparc64/kernel/traps.c:/* Why the fuck did they have to change this? */drivers/net/sunhme.c:printk(KERN_ERR "happy meal: Fry guys.");/* Remember: "Different name, same old buggy as shit hardware." */drivers/net/sunhme.c:/* Only Sun can take such nice parts and fuck up the programming interface * like this.  Good job guys... */drivers/char/ftape/compressor/lzrw3.c:/* Shit: we tried to decompress corrupt data */drivers/scsi/esp.h:/* The HME is the biggest piece of shit I have ever seen. */drivers/sound/hal2.c:/* Well, it is possible, that interrupt already * arrived. Hmm, shit happens, we have one more * buffer filled ;) */include/asm-sparc64/system.h:     "i0", "i1", "i2", "i3", "i4", "i5",               "o0", "o1", "o2", "o3", "o4", "o5", "o7");   /* If you fuck with this, update ret_from_syscall code too. */net/core/netfilter.c:/* James M doesn't say fuck enough. */net/ipv4/netfilter/ip_nat_helper.c:/* Grrr... SACK.  Fuck me even harder.  Don't want to fix it on the   fly, so blow it away. */drivers/char/ip2/i2ellis.c:// !!! Not Used, this is DOS crap, some of you young folks may beinterested in//     in how things were done in the stone age of caculating machines      !!!
Advertisement
// #ifdef HAHA
// #define TRUE FALSE
// #endif
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers

In specifications of some Nvidia OpenGL extensions you can find this:

Quote:
Additions to the WGL Specification	First, close your eyes and pretend that a WGL specification actually	existed. Maybe if we all concentrate hard enough, one will magically	appear.


You can find it yourself in the Extension Registry:
GL_NV_float_buffer
WGL_NV_render_depth_texture
WGL_NV_render_texture_rectangle

Perhaps you must be into OGL to find this funny...
"Dawn is a tramp." Dusk.
Here're some good ones from the Source SDK (Valve Software style!)

Quote: npc_crow.cpp, line 376:
//ARGH! Fix this up! THIS SHOULD NEVER HAPPEN!!! WHY GOD WHY!!??!

Quote: "Houston, there is a problem!" in ai_basenpc.cpp is kinda funny.

(my favourite:)
Quote:
//-----------------------------------------------------------------------------
// Purpose: If you don't know what a destructor is by now, you are probably going to get fired
//-----------------------------------------------------------------------------

Dude, where's my gun?
Quote: //-----------------------------------------------------------------------------
// Purpose: Returns how much damage the given ammo type should do to the victim
// when fired by the attacker.
// Input : pAttacker - Dude what shot the gun.
// pVictim - Dude what done got shot.
// nAmmoType - What been shot out.
// Output : How much hurt to put on dude what done got shot (pVictim).
//-----------------------------------------------------------------------------

Quote: // Purpose: Alyx, the female sidekick and love interest that's taking the world by storm!
//
// Try the new Alyx Brite toothpaste!
// Alyx lederhosen!
//
// FIXME: need a better comment block
//
//

Someone trying to find all the swears that he can:
Quote: (beam_shared.cpp) // Delete right away since it's fucked up
(c_baseflex.cpp) // FIXME: this angles make no damn sense
(AI_BaseNPC_Schedule.cpp) // use an EPSILON damnit!!
(simplify.cpp) // FIXME: bah, this is horrendously hacky, add a damn back pointer
(optimize.cpp) // Some initialization shite
(effects.cpp) // Just send the normal entity crap
(ModelEntities.cpp) // leave the physics shadow there in case it has crap constrained to it
(grenade_ar2.cpp) // The old way of making danger sounds would scare the crap out of EVERYONE between you and where the grenade
(npc_antlionguard.cpp) // If we hit a physics prop, smack the crap out of it. (large rocks)
(npc_citizen17.cpp) // This is crap right now.
(npc_CombineS.cpp) DevMsg( "OH CRAP!\n" );
(vehicle_airboat.cpp) // The airboat spits out so much crap that we need to do cheaper versions
(weapon_smg1.cpp) // crap, I don't want to blow myself up
Quote: Original post by capn_midnight
working on a project in software engineering class in java, someone had written this line of code

public void keyPressed(KeyEvent e){
...
textBox.setText(testBox.getText())
...
}

I added a comment directly above the code, just to see if anyone would catch it:

//From sm8236 to td1234: you're fired.


I'm not big on java, so I don't know if there is an easier way. Doesn't that copy the text from testBox and put it in textBox?

This topic is closed to new replies.

Advertisement