Go to bottom

Random source code comment thread

category: general [glöplog]
Code:/** * 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. */

Code: // // 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 //

Code: /* * 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. */

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

Code: /* These magic numbers are f*cking stupid. */ /* Dear free software world, do you NOW see we are f*cking things up?! This is insane! */ /* We will NOT put a f*cking timestamp in the header here. Every time you put it back, I will come in and take it out again. */ # However, this only works if there are MULTIPLE checkboxes! # The f*cking JS DOM *changes* based on one or multiple boxes!?!?! # Damn damn damn I hate the JavaScript DOM so damn much!!!!!! /* TODO: this is obviously not right ... this whole f*cking module sucks anyway */ /* FIXME: please god, when will the hurting stop? Thus function is so f*cking broken it's not even funny

Code: /* Emits a 7-Hz tone for 10 seconds. True story: 7 Hz is the resonant frequency of a chicken's skull cavity. This was determined empirically in Australia, where a new factory generating 7-Hz tones was located too close to a chicken ranch: When the factory started up, all the chickens died. Your PC may not be able to emit a 7-Hz tone. */ main() { sound(7); delay(10000); nosound(); }

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; }

Code: /* 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. */

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

Code: // I know the line below is wrong, but it came that way from our IP vendor, and // the driver won't work if you "fix" it. I've had to revert this change 4 times // now. Leave it alone, or I will hunt you down and hurt you if (r = 0) { }

Code: ## fucking imap fucking sucks. what the FUCK kind of committee of ## dunces designed this shit. ## imap talks about 'unique ids' for messages, to be used for ## cross-session identification. great---just what sup needs! except ## it turns out the uids can be invalidated every time the ## 'uidvalidity' value changes on the server, and 'uidvalidity' can ## change without restriction. it can change any time you log in. it ## can change EVERY time you log in. of course the imap spec "strongly ## recommends" that it never change, but there's nothing to stop ## people from just setting it to the current timestamp, and in fact ## that's exactly what the one imap server i have at my disposal ## does. thus the so-called uids are absolutely useless and imap ## provides no cross-session way of uniquely identifying a ## message. but thanks for the "strong recommendation", guys! ## so right now i'm using the 'internal date' and the size of each ## message to uniquely identify it, and i scan over the entire mailbox ## each time i open it to map those things to message ids. that can be ## slow for large mailboxes, and we'll just have to hope that there ## are no collisions. ho ho! a perfectly reasonable solution! ## fuck you, imap committee. you managed to design something as shitty ## as mbox but goddamn THIRTY YEARS LATER. ... ## ok, this is FUCKING ANNOYING. ## ## what imap.rb likes to do is, if an exception occurs, catch it ## and re-raise it on the calling thread. seems reasonable. but ## what that REALLY means is that the only way to reasonably ## initialize imap is in its own thread, because otherwise, you ## will never be able to catch the exception it raises on the ## calling thread, and the backtrace will not make any sense at ## all, and you will waste HOURS of your life on this fucking ## problem. ## ## FUCK!!!!!!!!!

Code: float Q_rsqrt( float number ) { long i; float x2, y; const float threehalfs = 1.5F; x2 = number * 0.5F; y = number; i = * ( long * ) &y; // evil floating point bit level hacking i = 0x5f3759df - ( i >> 1 ); // what the fuck? y = * ( float * ) &i; y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration // y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed #ifndef Q3_VM #ifdef __linux__ assert( !isnan(y) ); // bk010122 - FPE? #endif #endif return y; }

Code: // 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 alignement // 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.

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

Code: catch (Ex as Exception) { // oh crap, we should do something. }

Code: ... // get the units from the form int numUnits = Integer.parseInt(request.getParameter("num_pieces")); // this break at random times //price float price = Float.parseFloat(request.getParameter("price")); // same as above // Under certain conditions the following code blows up. I don't know those conditions. float pricePerUnit = price / (float)numUnits; ...

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

Code: /** * If you don't understand this code, you should be flipping burgers instead. */

Code: /* Sun, you just can't beat me, you just can't. Stop trying, * give up. I'm serious, I am going to kick the living shit * out of you, game over, lights out. */

added on the 2009-04-23 09:06:10 by Archedeus Archedeus
Code:; very lame code, no time...
added on the 2009-04-23 09:21:54 by StingRay StingRay
; ��copyright (c) 2k-1 by frank baumgartner (franky@scene.at) ��

; ow, ow! shiva did all the gfx, so why has only franky such a cool
; headline in this source file? Just because he wrote it? Bad franky!

(from void3 source)

btw. there's a good explanation of the Q_rsqrt routine on Chris Lomonts web site...
added on the 2009-04-23 09:31:31 by spike spike
Code:/* * Roses are red, * Violets are blue, * I read StackOverflow * And so do you! */
added on the 2009-04-23 09:37:33 by LiraNuna LiraNuna
Code:label { display:block; /* I swear I will kill the next developer who does this. */ margin-bottom:2px; }
added on the 2009-04-23 10:54:20 by gasman gasman
//TODO: fix this later
added on the 2009-04-23 11:22:36 by Preacher Preacher
added on the 2009-04-23 11:58:33 by d0DgE d0DgE
Code: ### READ DATA FROM BUFFERTABLES ### now this can be called optimized code \o\ |o| /o/
added on the 2009-04-23 12:08:12 by d0DgE d0DgE
Some from our old Z80 (assembler programmed) products:

%secaddDE crednowins ; update what ever the fuck this is


; *********
; * Shite *
; *********


; ********************************************************
; * Fucking cunting shitting pissing third hold win rule *
; ********************************************************


; ******************************
; * WTFIGO *
; * What the fuck is going on? *
; ******************************

(wtfigo is a subroutine)

; * Machine Dump V2.0 *
; * After all the shit with Norway, this routine *
; * has been improved to make it more robust. Cunts! *


; ***************************************************************
; * Process 3 - Dan's put the fucking air conditioning on again *
; ***************************************************************


; This really should be calculated from PRICE_PLAY - BUT WHO GIVES A FUCKING SHIT
; Well, I should! Because we'veoksjdflasjdf;jdsgjfls'jf the machine works cuntkdflsnlfna;fnfuck
; so this is a fucking bodge.


; what a tossa * a tossa is a useful comment


; ************* yes more messy code, it evolved, if u think its shit then you fuckin re-write it ok?


;;;; 5 = minuits x 10 (what the fuck is a minuit??! :-)


MUSTKEYLEV EQU 10000 ; amount where you absolutely, positively have to kill every motherfucker in the room.
; errr.. or key off. one or the other.


; * Accepts : No bullshit from anybody *
; * Returns : Nothing. *


; * RIGHT!! No more fuckin stack over-fuckin-flow shit *


; * Note that original comments stated that: *
; * - B is the win type *
; * - HL is description string *
; * but this is bollocks because both HL and B get fucked before *
; * anything is done with the above information! *


; NOT FUCKING IMPORTANT: This equate doesnt set anything


;W460 equ -6 ;(=250);shit one (they're all shit. the whole thing is shit. why did anyone do this shit?)


; fuckinhoorah - do jacky pot. (Officially sick of this machine 3.43pm 12th dec 2000)


; Oh my god, how fucking anal can I be commenting code like this?
; Especially as I had to tear myself away from surfing the internet
; all day long to do it! Well, just for one moment, did you ever
; consider that I was asked to produce a detailed list of electronic
; meters so that certain people could easily write down meter
; readings next to? No? Also I'm really sorry that I just couldn't
; manage to do it the obviously better way that you would have done it.


; * Crappy shit bollocks


; * I'm a fucking scuba

added on the 2009-04-23 12:16:23 by xeron xeron
Code:// obnoxious warning message to make sure this is noticed


Code:// okay, seems like we need to extrapolate.

Code:// ryg sez: hardgecodete matrix-mathematik, und dann auch noch // ohne danebenzuschreiben, was genau da eigentlich in welchem // koordinatensystem ausgerechnet werden soll? wtf?

added on the 2009-04-23 12:17:37 by ryg ryg
lame comments ...
Node *getParent() { return m_parent; } // Who's your daddy?

added on the 2009-04-23 13:37:08 by kusma kusma
You can find a lot of funny stuff in here if you search for funny words. I also didn't know there are my old codes in there (when I searched for michael kargas). I would add some of my favorites but they are mostly in greek(lish) comments (if you search for malakas :).

@Xeron: I didn't know you did some z80 code (or I forget something). For which demo(s)?
added on the 2009-04-23 13:39:06 by Optimonk Optimonk
From the PRICE_PLAY and "third hold win" stuff, I'm guessing that Xeron's code is from fruit machines.

At the Byte Back retro show a few months back I saw some of Jonathan Cauldwell's Speccy code, and I was amazed at how well-commented it was. He works on fruit machines in his day job too, so I figured that it must be standard practice for people coding Z80 for a living. I guess not... :-)
added on the 2009-04-23 15:04:49 by gasman gasman
// hier OpenGL flags abfragen und setzen (vgl GamesCD/hohoho)
added on the 2009-04-29 13:44:49 by raer raer
return returnValue; // return value

priceless :D
added on the 2009-04-29 15:01:12 by pro pro
// NSLog(@"%@ ask child to die", m_name);
[m_child childStop];
// NSLog(@"%@ waiting for child to die", m_name);
[m_task terminate];
// NSLog(@"%@ kill child if not dead yet", m_name);
added on the 2009-04-29 15:23:21 by neoneye neoneye
BB Image
added on the 2009-04-29 15:35:14 by dubmood dubmood
// drunk, fix later
added on the 2009-05-29 07:02:23 by sigflup sigflup
Code: /** * //FIXME: aaaaahhhhhhhhrg parameter massacre!!!111!1 * @param int $lang_id * @param String $org_name * @param String $db_name * @param String $path_name * @param String $path_basic * @param int $file_lang_one * @param int $file_type * @param bool $group_all * @param Array $fileInfo * @param int $priv_topic_id * @param [array $misc] * @return boolean */

...fixme line and $misc parameter inserted by myself ... it's a terrible terrible function
added on the 2009-05-29 11:18:35 by d0DgE d0DgE
Code:// This function is buggy and here for backwards compatibility only! Please DO NOT CALL IT! void syndicate(void) { ... } void reduce_latency(void) { ... syndicate(); ... }

added on the 2009-05-29 11:41:09 by decipher decipher
// after scale or rot or move: pp rot hass
added on the 2009-07-10 01:31:43 by raer raer

Roses are red,
Violets are blue
I read steakoverflow
and so are you

added on the 2009-07-10 04:41:22 by LiraNuna LiraNuna
// TODO: Improve this HEAP OF SHIT!!!!

// Init stuff
added on the 2009-07-10 09:56:45 by hashdash hashdash
//This option will boost the ingame speed, but also use more memory for the buffer.
//Enable if phone paints slow, and has available memory.
added on the 2009-07-10 10:06:04 by Puryx Puryx


Go to top