Advertisement

Funny source code/documentation/comments?

Started by January 16, 2005 10:53 PM
75 comments, last by jonaakey 10 years, 7 months ago
I once wrote (in java):
//constructor of some class for an assignment at uni. no-one got the reference.public Classname(...){    super(); // thanks for asking    ...}//after loading new firmware onto my most recent project (the tern is our embedded i386EX-based micro):Sleep(1500); //let the tern get it's $##7 in order//in my OpenGL framework code:if (m_fullscreen) //we have to bugger around with display modes    ...//----------------------------------------------------------------//// Finally, handle bootstrapping. Windows uses WinMain, not main()// like all real operating systems, so redirect WinMain to main().extern int main(int argc, char **argv);[insert placeholder WinMain() here]


[Edited by - fractoid on January 18, 2005 12:51:06 AM]
Quote: Original post by nprz
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?

I'm guessing that's a typo, and that capn_midnight really meant "textBox.setText(textBox.getText())". This would, of course, be quite pointless if setText() and getText() have the expected results, since you are merely reassigning the current value of the text box.
- k2 "Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ} | {Blog/Journal} | {[email=kkaitan at gmail dot com]e-mail me[/email]} | {excellent webhosting}
Advertisement
There are plenty of interesting comments in the ReactOS source tree ...

zlib headers:  /* various hacks, don't look :) */FreeType's TrueType interpreter:    /* UNDOCUMENTED!                                     */    /*                                                   */    /* The behaviour of an MIAP instruction is quite     */    /* different when used in the twilight zone.         */    /*                                                   */    /* First, no control value cutin test is performed   */    /* as it would fail anyway.  Second, the original    */    /* point, i.e. (org_x,org_y) of zp0.point, is set    */    /* to the absolute, unrounded distance found in      */    /* the CVT.                                          */    /*                                                   */    /* This is used in the CVT programs of the Microsoft */    /* fonts Arial, Times, etc., in order to re-adjust   */    /* some key font heights.  It allows the use of the  */    /* IP instruction in the twilight zone, which        */    /* otherwise would be `illegal' according to the     */    /* specification.                                    */    /*                                                   */    /* We implement it with a special sequence for the   */    /* twilight zone.  This is a bad hack, but it seems  */    /* to work.                                          */Cabinet manager lib:/* * ugh, well, this ended up being pretty damn silly... * now that I've conceded to build equivalent structures to struct cab.*, * I should have just used those, or, better yet, unified the two... sue me. * (Note to Microsoft: That's a joke.  Please /don't/ actually sue me! -gmt). * Nevertheless, I've come this far, it works, so I'm not gonna change it * for now.  This implementation has significant semantic differences anyhow. */adns lib:/* Define if we want to include rpc/types.h.  Crap BSDs put INADDR_LOOPBACK there. */kernel FPU code: /* FIXME: is this removed for non-debug builds? I hope not! */kernel memory manager:/* * FIXME: Has something to do with crash dumps. Do we want to implement * this? *//* FIXME - don't have a clue if this is right, but it's better than nothing */
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
Quote: Original post by kSquared
Quote: Original post by nprz
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?

I'm guessing that's a typo, and that capn_midnight really meant "textBox.setText(textBox.getText())". This would, of course, be quite pointless if setText() and getText() have the expected results, since you are merely reassigning the current value of the text box.


Oh, in that case, that person should be fired [lol]
I think I have done things like a = a; but only so I could add a breakpoint when debugging. Also, there is no semicolon, so I'm not sure that would compile [lol]
printk(KERN_INFO) "%s: hardware on drugs!\n", dev->name); [lol]


Man, reading this stuff at work is a very bad idea.... I gotta control myself not to laugh too hard. Some of them are hilarious.
Quote: Original post by Diodor
Working on the Mac port of my game (which I wrote entirely), I search a bug for a couple of hours, only to discover it on a line with a "not portable, sue me" comment.
Very good! :)

Perhaps off topic but, I always try to keep in mind that I am communicating with the future, and forgetful, version of myself when I write comments. It's always better to have too much explained than too little.

Matthew Doucette, Xona Games

Advertisement
I found this in the OpenGL VBO docs the other day:
Quote:
Should the usage and data arguments to BufferDataARB be swapped?

RESOLVED: NO. This would be more consistent with other things in
GL if they were swapped, but no one seems to care. If we had
caught this earlier, maybe, but it's just too late.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
//// IngredientsMenu.java - UI for modifying ingredients held in the system//// TODO: What the f**k is this.// TODO: Help...


An obsolete file I forgot to remove from the CVS repository. When a team member came across this file at 1pm, deadline being at 4pm, he was pretty worried. So he politely commented the file and handed in the code, for the next group to analyse. Suffice to say they had lots of fun examining the rest of our code to find things like:

//TODO: DOOOOM. DOOOOOOOOOM. DOOOOM. Yeh.//OMGWTFBBQ: I'll leave this for somebody else to do, my head hurts :(Integer CalculateFatContent(Meal meal){  Return 1234567;}
Quote: Original post by nprz
I think I have done things like a = a; but only so I could add a breakpoint when debugging. Also, there is no semicolon, so I'm not sure that would compile [lol]


<code>__asm int 3;</code>

Though that doesn't help you much in Java. [smile]

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

In my friend's level editor there's a comment before a complicated CSG function that was something like:

// Mmmmm, damn that's a tasty sandwich

I was reading through the code one day and I found that and couldn't help myself from laughing a bit. Yup, pretty pitiful. [smile]

This topic is closed to new replies.

Advertisement