Funny Things Seen In Source Code And Documentation

This page sprang from some off-topic anecdotes in BadVariableNames, that deserve their own special limelight :-)
WARNING: Don't do this! See "Watch Your E-Mouth" in WarStories.
function stop(){ //hammer time

}
I'm sorry - Old programmer who was about to retire with an ex-wife and two kids.
A collection of witticisms from LarryWall and the perl source can be had at http://www.cpan.org/misc/lwall-quotes.txt.gz

Or <http://en.wikiquote.org/wiki/Larry_Wall> -- there, you get links to their UseNet context as well.
Browsing the definitions in NISTs Dictionary of Algorithms and Data Structures, I stumbled upon this: http://www.nist.gov/dads/HTML/marlena.html
Not really a bad variable story, but I liked the index entries in an early book on dBASE III:
  Infinite Loop........see Loop, Infinite
and then a few pages later:
  Loop, Infinite.......see Infinite Loop
Editorial humor, can't live with it, can't live without it. -- RonReuter
One of my favorites from MFC drawing:
  CRect  rectUm;	//  darn near killed'em

An Acorn manual had "Recursion: see Recursion", in similar vein. See also RecursiveDescent. -- PaulHudson. This was on a bulletin board (or two) in the UK before the Acorn existed.

If you're going to do that then you should also feature "Tail recursion: see Recursion. If you're not sick of it already, see also Tail recursion."

Also "Mutual Recursion: see Recursion, Mutual". (I prefer this to the infinite loop one.)

Very off-topic but along the same lines ... an English dictionary I once owned defined "fog" as "thick mist" ... on looking up "mist" I discovered the definition to be "thin fog" ... this was my first introduction to recursion. -- PeteHurst
At the top of a particularly convoluted and otherwise completely uncommented code:

 // Abandon all hope, ye who enter here.

I'm in the habit of marking twisty, head-bending sections of code with a comment like:
 // here be dragons

Ideally I'll get back to that section and clean it up, but meanwhile...
Along the Book index type, there is in Michael Spivak's "Calculus":
 index->yellow pig:page->whole hog,  index->Derek, Bo:page->1,10,100,1000
-- ThaddeusOlczyk

Michael Spivak is known for his obsessions with yellow pigs and the number 17; his 5-volume opus, A Comprehensive Introduction to Differential Geometry is full of them. Yellow pigs appear on the covers; sometimes they are yellow policemen instead. Then again, he also wrote The Joy of TeX--A Gourmet Guide to Typesetting with the AmS-TeX Macro Package. -- EricJablow

And SpivakPronouns, too.
In some PHP code for a webpage I was hired to work 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!

That coder was particularly deserving of a solid punch in the mouth. Eh?
The index for Font Master II, a word processor for the Commodore 128, had entries for Life, Meaning of and Parrot, Dead that pointed past the end of the manual.
The Smalltalk source code of TheAnalyst? from XeroxSpecialInformationSystems? was always good for a few chuckles. Here are some favorites from memory:

Then there was a snippet from a CASE tool implemented in Smalltalk:

 somethingHappened := <some message expression>.

somethingHappened ifTrue: [...]

(I would hope that something happened, even if it wasn't what was being tested for :-)

But I think my favorite of all time is this little passage from the GemStone/S 4.1 Programming Guide, in reference to the fact that class Metaclass is an instance of an instance of itself:

"Think of the circularity in the metaclass hierarchy as posing a sort of object-oriented koan, whose contemplation may ultimately yield a higher spiritual awareness."

I was blown away that someone had the chutzpah to actually put this in commercial product documentation :-)

-- RandyStafford

I heard that three customers achieved enlightenment as a result of this.
Some versions of the documentation for awk on Unix contain this explanation of a variant of the for loop:

 for (i in array)
 statement
does statement with i set in turn to each element of array. The elements are accessed in an apparently random order. Chaos will ensue if i is altered, or if any new elements are accessed during the loop.

I remember reading this and envisioning flashing lights and whooping sirens ... -- GlennVanderburg
Legend has it that the following is found in an ancient IBM manual:
 * Single bit errors are detected and corrected
 * Double bit errors are detected
 * Undetected errors are ignored

My favorite snippet of Perl code ever found in source:

  .
  .
  .

my $search_key = $something_else; foreach (keys %some_hash) { if ($_ eq $search_key) { do_something($_); } }

. . .

For non-Perlites, this code can be written as

  do_something($something_else) if exists $some_hash{$something_else};

which makes it one line instead of lots, and takes O(logn) instead of O(n).

-- JeffBay

His search key is something else, all right! Now where did I put that Stick-Up?
Some stuff moved to ThisPageIntentionallyLeftBlank.
I worked on a system many years ago that would put up codes instead of error messages. You would then have to look the code up in the book. One day it produced a code that had an error message that said "You have reached a logically impossible state." We went out for beer after that. -- FrankMcGeough

The most irritating message while using ICL Algol 68 error was
 Impossible Happened
Adding a blank card could fix the problem. -- DickBotting

Reminiscent the Amiga, with its system errors called Guru Meditations: you could look the number up for an "explanation", but should be prepared to encounter the occasional description like, "Weird echo causing incomprehension." Sometimes I wished for a peek at the source code to learn just how this "echo" was actually being detected.

My favorite error of all time simply said, "Impossible." -MrPhil
The project I just completed gave me an opportunity to add a CausalityViolationException?. The exception's message text was "This should never happen. XXXX.checkValid() should have thrown a YYYY exception long before we got here..."

I'm looking forward to hearing from the programmer who discovers that in a few years...

A former colleague had the habit of putting amusing parameter strings in GUI components that needed to be instantiated at one point in the code but have their label set later on in the code, before they were displayed. I still remember the day when I first encountered:

  JButton foo = new JButton("Slowly I turned, step by step...") ;

A rather dated error message from a homebrew mainframe accounting system:

"Out of memory. Call John M_____ at x555, and tell him to order another 16K."
The http.conf that comes bundled with the Apache webserver distribution has a comment:

"Do NOT simply read the instructions in here without understanding what they do."
The library routine names in the Playstation apparently were translated phonetically from Japanese to English. So instead of MergePrim() we got to call MargePrim(), and had documentation referring to a "clit index" instead of a CLUT index (Color LookUp Table index). I did play QuakeII online as "marge prim" for awhile, 'cause it made such a cool name. :-)
See http://www.multicians.org/hodie-natus-est.html for an amusing Multics story. (An error message in Latin.)
Recently worked with a developer whose favorite error message was "Game Over!" Needless to say the Client wasn't happy about that during Beta testing... Same programmer/analyst was working with Delphi a few months later... I noticed the variables PenIsUp and PenIsDown... I made him change them... -- SAP
On refactoring the help system for our application (originally written by a *very* junior programmer who among other things didn't know what an 'else' was), I found three variables in a block:

fu, ga and zi

I had a good laugh, and then realized I had to figure out what the heck he had used them for, and stopped laughing quickly. -- JohnWatson
Continuing in a musical vein... I wrote some marshalling/demarshalling code for a C++ middleware platform. Data sent between machines of different endianness needs to be byteswapped by the receiver. The sender needs to set a flag in the header to indicate its endianness. Some systems (CORBA for example) compile the middleware libraries to know their endianness, and send a boolean flag indicating big-endian (true) or little-endian (false). As we were planning to port the system to different architectures, I didn't want to have to maintain a list of endian flags by platform as #ifdef's in the code. Instead, I used a 2-byte field in the header of each message. The sender would set the field to a well-known numeric value, each byte of which was different. The receiver would check the field in received against the well-known value. If they were different, the receiver would have to byte-swap values in the message.

The well-known numeric value was 57005. I called the header field 'elvis'. Why? Because the code that checked the value then looked like:

 Message msg = ...;
 uint16 elvis;

msg >> elvis; if( elvis != 0xDEAD ) { ... must byteswap data in the message ... }
Groan!

-- NatPryce
Two oldies but goodies

Found in a Burroughs Master Control Program Circa 1974, a procedure called
 J EDGAR HOOVER
in charge of security.

One of the neatest tricks in Algol68R system was that any ref variable (like think pointer) was by default initialized to point at a four character constant that read:
 F001
in the dump that occurred when following an uninitialized pointer.

-- DickBotting

It's surprising how many puns you can make with the letters A..F, and whatever letters you can represent with the digits 0..9. E.g. The Java virtual machine expects the first 32 bits at the front of a class file to be 0xCAFEBABE. I have also seen code that uses 0xDEADBEEF to represent uninitialized data.

See the JargonFile entry at <http://catb.org/~esr/jargon/html/D/DEADBEEF.html> for details.

Yes, I once created a magic number 0xBEEFCACA just for kicks. I BS you not.
foobarStubbornAsAWetDogTimeout = 0;
  // Hocus Pocus, grab the focus
  winSetFocus(...)

In a student's code for the MATLAB course I TA:

	x = 0;
	while x < 5
	x = x + 1;
	end
	%do something with x ... 

In a previous existence as a programmer I used to work on code which attached cookies to the start of allocated heap objects and regularly tested them to determine if memory corruption was occurring. I didn't know this until one day my application terminated with the message :

"Fatal : Bad Magic".

Needless to say, I was scared.
Once upon a time, my workplace used a common comment convention: "$" meant "Note", "$$" meant "Warning: This code could be done better", and "$$$" meant "This must be fixed before we ship". These are easy to search for in C code, of course, because the "$" character is not often used. After a while, "$$$" starts to jump out at you.

One very late night, scanning through some of the framework code, written by the local gurus, I saw this and nearly died laughing:

 if (x == 1)
  x = 1; // $$$$$$$$$

[This is so you can put a breakpoint on that line, of course.]
Many moons ago I received an e-mail from someone who'd read my USENET post on an unrelated topic. He'd spent the last 3 weeks suffering in a class to learn how to configure a certain big-iron RDBMS. His e-mail told me when he read the tag line under the signature on my post he actually fell off his chair laughing. -- PCP

 -- Whip me. Beat me. Make me install Oracle. --

 try {
 //...
 } catch (SecurityException sex) {

In REALbasic you can't save a breakpoint in your project between edit sessions, tomorrow when you open your project the breakpoints will be gone. So I came up with this little trick instead:

 //these are declared as globals, included with some debugging module
 dim breakpoint as boolean, here as variant

...code code

breakpoint=here

code code...
The compiler halts and complains with an "Unhandled typemisMatch exception" error, but immediately scrolls the window to bring your attention to the exact spot in the code you were last working on. I suppose any other non-boolean vartype would have worked for "here" as well, but "variant" almost implies the location of the breakpoint could change. -- CarstenKlapp
I knew guy who worked on FidoNet software ages ago. In his sources he had a toggle variable named "full_tilt_boogie_mode." -- MichaelFeathers
("empty else idiom" moved to HandleAllElseConditions)
Also from early 1970's Burroughs 17xx MCP, I recall a routine named Interrupt Handler that did pretty much what you'd expect. It was preceded by a LOONNGG comment block that talked about dispatching processes from the ready queue and other such Impressive Terminology, and concluded by saying that

 "if nothing else can be found to run, will go feed the ducks."
-- JoelNeely
Reminds me of a (probably fictitious) Air Force maintenance log that reads: Pilot: Dead bugs on windshield. Maintenance: Live bugs on order. Pilot: DME unbelievably loud. Maintenance: DME volume set to believable level. Pilot: Autoland feature causes unreasonably hard landings. Maintenance: Autoland not installed on this aircraft....

Available at <http://www.netfunny.com/rhf/jokes/97/Jun/usaf.html>.
Once I had a junior programmer writing VB code that needed to know the day of the week. He decided to write his own code, and read something like:
 if (day = 1) or (day = 8) or (day = 15) or (day = 22) or (day = 29) then
 weekday = "Monday"
 elseif (day = 2) or (day = 9) or (day = 16) or (day = 23) or (day = 30) then
 weekday = "Tuesday"
 ...
Trying to be educational I asked him for his opinion about his own code, and he said that he would simply modify it every month.

-- PedroChan?
The phrase "terrifying code" shows up several times in the source for the Perl interpreter, particularly in the lexer, which apparently does most of the work.

If you haven't seen the Perl source before, it's worth a look. It truly IS terrifying.'
Couple quotes from the documentation of a system I was working on a couple of years ago. Translated from Russian.

"For working with the system, it is recommended to use a multi-button mouse with two buttons".

"The visible state should be understood as the state when an element is shown (displayed) on the screen and is not hidden (invisible)".

The documentation also stated that you can use the number of hours in a day as a filter criterion. I never figured out what the documentation writer really meant.

A longer text dating back from the same system is at WritingUnmaintainableSql.

-- DmitryJemerov

*sigh* Looks like another instance of ExcessiveDeletion?. It _used_ to be at WritingUnmaintainableSql, but someone killed it, I assume.

Not really. WritingUnmaintainableSql came to life only about half an hour after my entry at this page. You may even call this TestFirstDesign. -- DmitryJemerov

I'd call it TopDownDesign... -- DanielKnapp

You'd be wrong-o. Design and implementation are two completely different things, as has been discussed to no end on this board.
The BeOS programmer's guide covers two functions IsComputerOn (returns 1.0 if computer is on, unspecified otherwise) and IsComputerOnFire (returns temperature if mainboard has flames coming from it, unspecified otherwise). It's right there in the printed version (though I quote from memory).

The C++ Standard (ISO/IEC 14882/1998) has a limerick: "When writing a specialization, be careful about its location, else to make it compile, will be such a trial, as to kindle its self-immolation" if I recall correctly.

Yep, it's in section 14.7.3, "Explicit specialization", on page 274 of my copy -- JamesYoungman

TeX on occasion will spit out the error message "Look up 'weird error' in the TeXbook?. Sure enough, the information you need is there. -- JamesDennett
SCO Unix/Xenix cores used to have the error string "The Universe Has Ended" after the familiar "panic" and "double panic". Fortunately this never happened. -- RichardHenderson
A head hitting desk/small despairing scream moment:

 /**
  * FOR CLASS INTERNAL USE ONLY
  */
 public void someMethod() {
 ... some code...
 }

-- DarrenHobbs

You know, that can actually be hard to avoid, thanks to the way Java implements callbacks. For example, if I want to make my class implement the Runnable interface, I have to expose a public run() method, even if I don't really want just any passer-by to call it. Of course, the right thing to do is to use inner classes. Unfortunately, the way these are handled in Java is IMHO bloody inconvenient, particularly if one is writing something simple like an Applet. -- IlmariKaronen

You can abuse doubly curly braces a bit for stuff like that.
I was deep in the innards of a system application, I think it was Smalltalk (at least that's what I'll use in this telling). The module was attempting to do massive cleanup and finalization, and multiple paths lead to a routine that managed instances of a HUGE object that was the root of an enormous directed graph. The routine itself was long, and at the critical point I found something very much like this:

  theFinalInstance := nil. "I love code with power: rmc"
I have always relished that comment.

-- TomStambaugh
Something quite irrelevant was discovered in /usr/share/misc/ on my NetBSD machine. I later printed it out and decorated my house with it.

 # Flower : Meaning
 # $NetBSD: flowers,v 1.2 1997/03/26 06:30:56 mikel Exp $
 # @(#)flowers 8.1 (Berkeley) 6/8/93
 #
 # Upside down reverses the meaning.
 African violet:Such worth is rare.
 Apple blossom:Preference.
 Bachelor's button:Celibacy.
 Bay leaf:I change but in death.
 Camelia:Reflected loveliness.
 Chrysanthemum, other color:Slighted love.
 Chrysanthemum, red:I love.
 Chrysanthemum, white:Truth.
 Clover:Be mine.
 Crocus:Abuse not.
 Daffodil:Innocence.
 Forget-me-not:True love.
 Fuchsia:Fast.
 Gardenia:Secret, untold love.
 Honeysuckle:Bonds of love.
 Ivy:Friendship, fidelity, marriage.
 Jasmine:Amiability, transports of joy, sensuality.
 Leaves (dead):Melancholy.
 Lilac:Youthful innocence.
 Lilly of the valley:Return of happiness.
 Lilly:Purity, sweetness.
 Magnolia:Dignity, perseverance.
 Marigold:Jealousy.
 Mint:Virtue.
 Orange blossom:Your purity equals your loveliness.
 Orchid:Beauty, magnificence.
 Pansy:Thoughts.
 Peach blossom:I am your captive.
 Petunia:Your presence soothes me.
 Poppy:Sleep.
 Rose, any color:Love.
 Rose, deep red:Bashful shame.
 Rose, single, pink:Simplicity.
 Rose, thornless, any color:Early attachment.
 Rose, white:I am worthy of you.
 Rose, yellow:Decrease of love, rise of jealousy.
 Rosebud, white:Girlhood, and a heart ignorant of love.
 Rosemary:Remembrance.
 Sunflower:Haughtiness.
 Tulip, red:Declaration of love.
 Tulip, yellow:Hopeless love.
 Violet, blue:Faithfulness.
 Violet, white:Modesty.
 Zinnia:Thoughts of absent friends.
Perhaps suitable to give to a loved one accompanied with appropriate flowers?

-- MatthewTheobalds

I almost don't want to spoil this with an explanation, but... what you have found is a data file for quiz(6). To take the quiz, you would type "quiz flowers meaning". Among the other amusing quizzes available are "quiz victim killer" and "quiz Middle-Earth capital". --MossCollum

Two classic COBOL variable names in the code for a retail chain where I worked. Both were booleans that switched between different modes of operation: STUPIDF***KINGCHECK and BEEGEESFOLLYSWITCH -- B.G. was the initials of the programming manager who created the first version of the code and handed it off to other programmers.
 float sinful = sinf(angle);
 float costly = cosf(angle);

In a Windows program, an OK-button message box that came up whenever things went rather badly:

	What the F**K are you looking at?

One of my favorites came up during a customer demo. In the middle of something innocuous, an angry message box appeared:

	Dammit, Darin! I told you not to call me!

I wish I still had my favorite documentation snippet. It was the description of the sound function in Borland C. It went something like "16 Hz is the resonant frequency of a chicken's skull. This was determined empirically in Blah, Blah, Tennessee when a factory was built next to a chicken farm. On the first day of operations all the chickens died. You may not be able to generate a tone of 16 Hz on your PC speaker." -- MichaelFeathers
From a database adaptor for Zope (this killed me every time i saw it. never knew who put it there):

 if p=="'​'": p='​' # Dumb ass.
-- jps


Seen, and believed...
 [some long and messy code] # too drubnk to make this workkkkj. debugg latter.

The classic piece of COBOL:

 PERFORM SEX WHILE MAN EQUAL TO TASK

Also COBOL:

 REPEAT
	...
 UNTIL THE-COWS-COME-HOME
(or HELL-FREEZES-OVER, or YOU-GET-BORED, or any of a number of other things)
In MrBunnysBigCupoJava there is the statement "A Java compiler compiles Java code into errors and warning messages, and in the process produces class files containing bytecode."
In the spirit of AllYourBaseAreBelongToUs

 # All your space are belong to perl
 $customer =~ s/ //g;

I liked the early 80x86 assembler directive:
  ASSUME NOTHING
It had meaning much beyond the original intention. Also, I once had to look through an assembler program which had about 15000 lines of uncommented code. Right in the middle was one solitary comment:
  ld a, 1 ; load 1 into the accumulator
Why the contractor thought that one statement needed commenting I don't know!

The contract probably stated, "must document code". So, he did.
I once saw a piece of C code where the programmer needed to move a pointer up 5 spaces in a character array. Rather than writing:

 p += 5;
He wrote:

 for (int i = 0; i < 5; i++)
	p++;

Somewhere in GNU source code, there's something like this:

 #ifndef STACK_DIRECTION
 you
 loser
 #else
-- SavasAlparslan
There was a page of highly optomized PDP-8 assembler in the middle of a simulator. It had one comment
 HLT ; If you get here you are in trouble
-- MarkSwanson
One day a CDC 3400 suddenly printed a message and crashed. The message said: "On June 7, 1969 Josep Hurley declared that this case would never happen and we didn't need to handle it." The other, slightly junior, system programmer had added it after he lost an argument.

-- MarkSwanson

A variation: "If you see this message, John Doe lost the bet and must show up next work day in a chicken suit. Suit in locker 41, combo 13-7-30"
An early version of the MAGIC Rad tool was reputed to emit a message that said "MAGIC will now crash your system" -- DominicCronin
A circuit board logic simulator was greatly speeded up by checking for a specific condition and then jumping past a bunch of other steps. Finding and making this optimization took only half a day. Then the argument began about what to call the jump label (i.e. what was it that the simulator was really doing?)... Two days later, the programmer cut off the debate by relabeling the target 'Raspberries', since "You can't argue with a total non-sequitur," and made his release date.
In the Java libraries (as of 1.5), at line 340 at java.awt.datatransfer.MimeType and line 295 of java.awt.datatransfer.MimeTypeParameterList, is:

 // below here be scary parsing related things

And indeed there are.

Another funny thing (actually sad) is the duplicated code in the two classes, including JavaDoc and this comment. -- DanielYokomiso

There's also this in java.io.ObjectStreamClass (up to jdk 1.3.1 only):

  //WORKAROUND compiler bug with following code.
  //static final Class[] OIS_ARGS = {ObjectInpuStream.class};
  //static final Class[] OOS_ARGS = {ObjectOutpuStream.class};
If you can't see why this is so funny, check http://www.javaspecialists.co.za/archive/Issue046.html. -- DanielYokomiso
Also in the JDK, the java.awt.FontMetrics? class has a deprecated method: int getMaxDecent() The javadoc comment for this method simply says: " Deprecated. As of JDK version 1.1.1, replaced by getMaxDescent(). " And indeed, the method getMaxDecent() simply calls getMaxDescent(). How embarassing to have typos in the public API. Downright indecent, in fact.
And then there's UNIX:

http://cm.bell-labs.com/cm/cs/who/dmr/odd.html
A Russian gentleman on comp.lang.java.programmer, answering a question about floating point maths:

 forget everything from school -- you are programmer,
 and here 2.1*3.6=7.559995
 but sometimes (2.1*3.6==7.559995)!=true
 this is the world with no rules after point -- this is computer.

The PlanNine documentation contains a man page for emacs: http://plan9.bell-labs.com/magic/man2html/1/emacs

To be fair, they also have vi, but it's not the one you are probably expecting: http://plan9.bell-labs.com/magic/man2html/1/vi

There is a new command called yesterday(1) and under the section BUGS: 'It's hard to use this command without singing.'
case EFT_KEY_PRESS:
  // Shouldn't ever happen... so close display if it does
  ecr_close_display();
  break;

From the MFC source:

// according to the Win98 docs, this should be 1

// according to the WinNT docs, this should be 2

// they are both wrong!
Pilot Flight Report: Something in airframe loose

Maintenance repair log: Something in airframe tightened.
Spotted recently in some source: "above comment might not be true"
// thread the hand the query waiting.
Keyboard not found. Press F1 to continue. [ok, so I haven't seen the source for it, but it has gotta be in there, no?]

It's "Keyboard error (or fault, can't remember)." and you could generate it oj early PCs by booting up while holding a key down...

Actually, on the PCs I've used in the past, if you left a keyboard unattached, it literally would display the aforelisted error message, character for character. --Samuel A. Falvo II

You can still generate it quite easily depending on the bios (and it is often as quoted above:)
A few favorite examples from a previous employer:

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

 // Return a status block suitable for inclusion in the reply
 // buffer to Control.  Note: this code sucks.
and my favorite:

 /* 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.
  */
The "XYZ project" (name changed) was a seven-year ordeal. That last comment was written by the one stalwart soul who was involved from the very beginning through to the end.
There was an EmacsLisp module that had to define a couple functions to get the emacs18 byte compiler to "do the right thing." The source code was something along the lines of

  (defun emacs-18-byte-compiler-sucks-wet-farts-from-dead-pigeons ()
 (nuke-em-till-they-glow))
I guess they were trying to avoid name conflicts...
In a C file from one of our, thankfully now end-of-lifed, products there was a 450+ line macro with the name DO_YOUR_FUNKY_STUFF.

Which was all very amusing originally, until I had to figure out what it did...
From the man page for bless on MacOsx:

BUGS
 bless has no bugs
-- RobRix
From the project I currently work on:

  if ((eIOObjectType == Prototype_  && HR_FAILED(SchemaProcessor.ValidateAndOrCreate())) ||
	(eIOObjectType == Production_ && HR_FAILED(SchemaProcessor.ValidateOnly())) )
  {
	ASSERT(FALSE);
	// Don't put an assertion here; there are enough assertions in the
	// schema processor to kill a horse already.
	return HR_Failure;
  }
The poor horse...
"If you are new to Vi and Vim, using 'nocompatible' is strongly recommended, because Vi has a lot of unexpected side effects, which are avoided by this setting." -- Vim manual
  return this; // todo

In Java, we had class A with private member variable aIndex. In the derived class B the programmer had private member aIndex. B's programmer was too lazy to type in the names of the accessors for A.index and instead thought that redeclaring would cause the two variables of the same name to refer to the same entity. He was even thoughtful enough to mark his obfuscation with a comment, "/* redeclared here for clarity */". We all had a good laugh, except for the person that had spent a week trying to track down the bug caused by this stupid programmer mistake.

  public class A {
	protected<type> foo;
	public void setFoo(<type> fooVal);
	public <type> getFoo();
	public void doSomething() {
	. . . 
	foo = x.munge();
	. . .
	}
  };

public class B extends A { /* redeclared here for clarity */ protected foo; public void doSomething() { . . . foo = x.munge(); . . . }
-- DavidMcReynolds

PairProgramming could have prevented this. Only if one of the halves of the pair knew what he/she was doing. You're right. If all the programmers are dumb, pair programming doesn't help. But then, nothing helps...
Working with FTX on Stratus, one day I decided to play around with the various implementations of FTP I had available to me, (AIX, HPUX, FTX, VOS). On the FTX machine using the man-page example I tried to tell FTP to use different ports (just for the fun of it, to see if it would even attempt to connect). The system responded You must be kidding.
I used to work with a programmer who seemed to name variables by whatever was on his mind -- or the radio. His code was littered with function, array, and variable names like: Jocko, Bunny, Coffee and Gilligan.

So it was not uncommon when reading his handiwork to encounter code that used Jocko to index into Coffee after passing Bunny to Gilligan. Oh, now that's just wrong!

He also preferred to copy code rather than to type it, and would grab a chunk that did something like he wanted to accomplish (comments and all), paste it where he was adding functionality, and then hack it until it worked (based on his definition of worked). I found this out when trying to understand what some Gilligan-like function was doing when I realized that a comment I was looking at, not only didn't refer to the program I was working on, but was from code in a program for another client altogether -- I know that because the other client's name was in still in the code of the client whose code I was looking at.

-- BillCaputo
The documentation for Slash, the code which runs SlashDot, has a section "BENDER'S TOP TEN MOST FREQUENTLY UTTERED WORDS"; Bender being the robot from Futurama, of course. See <http://slashcode.com/docs/Slash.html> for details. That list is taken from the episode "War Is The H-Word" of Futurama...Season 2, if I remember correctly. Great episode, one of my favorites. Now, why that list in the HTML source for SlashDot? Life's full of little quandaries. it is there to be used in the http headder (<http://tools.seobook.com/server-header-checker/?page=single&url=slashdot.org&useragent=1&typeProtocol=11>
I've taken on the role of maintaining a SourceLawn? (what is a source lawn? Think of a source tree, with many branches... now, think of a lawn) of code in the PlbLanguage. One of the routines was called ABORT, It pretty much looked like this:

 ABORT Routine
 .	.	First things first, get rid of all trap conditions.

trapclr all

. . Now, KILL FOR KALI!!!!!

chain "zyxvutsrqonm"

return
The funny thing is that chain "zyxvutsrqonm" is guaranteed to fail (unless there is another program named zyxvutsrqonm). Why there needs to be a return after that, I am not sure....
I'm still getting a smirk out of some CommonLisp FormatDirective?s for pretty printing. For example:

(defun pprint-flet (stream list &rest noise)

: (declare (ignore noise))

: (funcall (formatter

: "~:<~^~W~^ ~@_~:<~@{~:<~^~W~^~3I ~:_~/PP:PPRINT-LAMBDA-LIST/~1I~:@_~@{~W~^ ~_~}~:>~^ ~_~}~:>~1I~@:_~@{~W~^ ~_~}~:>")

	stream

list))

Where all those funky escapes are specifying indentation and line-breaking rules. -- LukeGorrie

Some of that almost looks like a bunch of Asian-style emoticons. I think ~_~}~:> is the emoticon for one's brain flying out one's ears. :-p --CodyBoisclair @_~@ I'm listening to music on my headphones. alternately, my left eyeball has popped out and is dangling by my optic nerve
 /* DO NOT UNCOMMENT THIS WITHOUT TALKING TO <name of programmer> */
Found a year after the product was sold to our company; programmer was nowhere to be found, so I uncommented it with no ill effect.
 void BeginHackyEndScreen();
 void EndHackyEndScreen();

 TRACE ("Life sucks\n");
 return NULL;

 // 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.

When the ON/OFF button is in the OFF position radio fails to operate.
From the QnxNeutrino documentation:

: The internal date and time representation reaches its maximum value in 2554. If your system must operate past 2554 and there's no way for the system to be upgraded or modified in the field, you'll have to take special care with system dates (contact us for help with this).

Since the target market for that OS includes things like deep space probes, that case just might not be quite as unlikely as one might think... -- IlmariKaronen
From the BEA WebLogic Server version 8.1 "Configuring and Managing WebLogic Server" document, pp 1.20 - 1.21:

: "To start the Administration Console:

: 1. Start an Administration Server. See Starting Administration Servers in the Administration Console Online Help."
Every chapter of the VAX/VMS Internals book started with a related quote. The chapter on Memory began with:

  "I was in the Eagles?  Cool!" -- Joe Walsh

Just now I tried to click on the "UCB DBMS Research Group - Research" page and Galeon spit back "Document contains no data."
From a routine that cleaned out some caches.

  // 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?
Aah, a fellow New Zealander. Tidy Kiwi is a reference to an ad campaign in the late 80s to encourage New Zealanders to not litter. Just in case anyone is thinking of the green furry fruit called kiwis in America. The Kiwi is the official bird of New Zealand, and used as a nickname for an NZer, kiwifruit were branded such for marketing reasons. They were originally called Chinese gooseberries. -- Liam Clarke
The source code of PerlLanguage's Net::IRC modules has numerous chunks of funny conversation from the #perl IRC channel in it. My favorite:

 # -- #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 cocks 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.

Eww, gross, you just made us think of RMS having sex. Disgusting. The stuff of nightmares.
	I'm sorry. I was young and foolish. :-(	-- dpt
From one of the same modules:
 # Ye Olde Contructor Methode. You know the drill.
 # Takes absolutely no args whatsoever.

	/* XXX Grand unified hard-coded badness; this should go into libpq */
	#define pg_encoding_to_char(x) "SQL_ASCII"

	// Everything is shamelessly stolen and rewritten.
	// Feel the consequences of GPL ;-)

  NAME
	update_shebangs.pl

SYNOPSIS INCREDIBLY DANGEROUS TOOL to rewrite all the shebang paths of perl scripts under the current directory to use the perl you run the tool with. Frankly, I suggest you never use this tool ever.

  ProcessCommandLine( argc, argv );
  if ( bUseCheese )
	dbgDisp.Initialize();

I really liked the aproach this code that had to process the first 5 tokens of a list (or less if there weren't so much).

 int j = 0;
 if (tokenCounter >= 5) {
	j = 5;
 }
 else if (tokenCounter == 4) {
	j = 4;
 }
 else if (tokenCounter == 3) {
	j = 3;
 }
 else if (tokenCounter == 2) {
	j = 2;
 }
 else if (tokenCounter == 1) {
	j = 1;
 }
Maybe it was a case of taking FakeIt that step too far.
We have an internal web page that displays departmental structure as taken from a database in a tree structure. The default was to sort siblings alphabetically, but the dept. head wanted one of his direct reports to sort to the bottom instead of the top. When I went to modify the code a while back, I came across this comment:

/* Brutal Political Hack */

followed by a bunch of code that included a boolean variable called "bIs[Employee Name removed for anonymity]"

followed by /* Untainted version */ which had the "brutal political hack" removed.

There are really people that petty in the world? Sheesh.
I recently ran across the following C function in production code:
 int xilinx_prog(softc_t *sc)
 {
	if ((sc->status & (XILINX_PROG | XILINX2_PROG)) !=
	(XILINX_PROG | XILINX2_PROG))
	return 0;
	return 1;
 }
After much staring and some refactoring, I finally came up with:
 int is_xilinx_programmed(softc_t *sc)
 {
	return (sc->status & XILINX_PROG) && (sc->status & XILINX2_PROG);
 }
This was in the same system that had undocumented utilities with argument checking code like:
 if (q == 1) {
	printf("Silly user, you must enter the correct syntax "
	"-i1 through 5 or\n -s1 through 5 and -d1 through 5\n");
	exit(0);
 }
Neither of these examples is "ha-ha funny", and the first example isn't "peculiar funny", either; it's standard bit flag stuff. Woe unto any C programmer doing XILINX work who has trouble understanding the code as it was first written; you'd better brush up on your bit manipulations if you expect to understand XILINX devices, let alone C. Those who hate bit manipulation shouldn't be in that line of work. Look again. The author's problem was not with the use of bit masks (indeed, his solution shows that he understood them better than the original coder did), but with the facts that a) the comparison was poorly written (if nothing else, the original coder should have factored out the repeated bitwise OR term to a temp variable), and b) the if clause and the returns were completely unnecessary, as the function was effectively returning a boolean based off of a single extended comparison. I agree that it wasn't funny, though, so much as sad. - JayOsako Suppose sc were volatile and reading the status cleared it. Then the original code should remain.

The second example is somewhat lacking in context, but it looks like the point is that some hardware engineer chose somewhat opaque syntax - as they usually do.

The original code was perfectly reasonable for its context, and the replacement code isn't even sure to be functionally identical! The original test did a single read of a status register, an operation which can often have side effects in embedded systems, and then a single mask and comparison. The replacement does two separate read, mask, and compare operations...the second of which may end up testing a flag automatically cleared by the first. And as mentioned, explicitly returning 1 or 0 avoids problems with strange definitions of boolean values. True and false values weren't always standardized, and development environments for embedded systems are particularly prone to odd deviations from standards. The flags should be given a separate define to make things a bit clearer, but that's all.

So anyway, not funny, not peculiar; should be moved to a different page.
From the JargonFile:

The PDP-10 Reference Handbook (1969) contained a footnote on the first page of the documentation for DDT that illuminates the origin of the term:

: Historical footnote: DDT was developed at MIT for the PDP-1 computer in 1961. At that time DDT stood for "DEC Debugging Tape". Since then, the idea of an on-line debugging program has propagated throughout the computer industry. DDT programs are now available for all DEC computers. Since media other than tape are now frequently used, the more descriptive name "Dynamic Debugging Technique" has been adopted, retaining the DDT abbreviation. Confusion between DDT-10 and another well known pesticide, dichloro-diphenyl-trichloroethane C14H9Cl5 should be minimal since each attacks a different, and apparently mutually exclusive, class of bugs.

: (The tape referred to was, incidentally, not magnetic but paper.) Sadly, this quotation was removed from later editions of the handbook after the suits took over and DEC became much more businesslike.

[Obviously the name DDT originally came from the bug-killing pesticide, and "DEC Debugging Tape" was a BackroNym.]
One of my first programming projects was a POS (in either expansion of that acronym) in MsDos FoxPro for a local computer store I was working for in 1996. I was a bit more whimsical than I should have been; for example, the customer table was named 'suckers', while the employees table was 'slaves'; the main error handling function, 'oops', popped up a window named 'S_O_L'; and so forth. The project was never finished, but I held on to the code for ir's humor value; it can be seen at http://josako.freeservers.com/tech/FoxPro/ - JayOsako

(Insert theory about correlation between whimsical naming conventions and projects not finishing here. Also, note to self: Do not hire JayOsako.)
 The following code was written by <developer name>.
 Unless it doesn't work, then I have no idea who wrote it.

Some of the better error messages from Apple's MPW compiler, from a posting by Bruce Hoult on comp.sys.mac.programmer:


I just spotted this in the source code for one of the ApacheAnt tasks:

	:	/*
	:	*  build notes
	:	*  The reference CD to listen to while editing this file is
	:	*  Underworld Everything, Everything
	:	*  variable naming policy from Fowler's refactoring book.
	:	*/

The VAX/VMS XDELTA debugger (used for debugging kernel-mode code) has one single error message:

	Eh?

The LambdaMoo source code had this gem around an alternate (and simpler) implementation that assumed the existence of a library function that wasn't standard at the time:

 #ifdef I_HAD_MY_DRUTHERS

 % tar cvf foo.tar
 tar: Cowardly refusing to create an empty archive

Spotted in the Windows API:
 PathYetAnotherMakeUniqueName

Field name in an accounting system: RAVERS-FUN-EXPENDITURE
/usr/src/linux is full of fun.

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

* These chips are basically fucked by design, and getting this driver * to work on every motherboard design that uses this screwed chip seems * bloody well impossible. However, we're still trying.

* skb to avoid No=0 (choose one: Ugly [ ] Tasteless [ ] VMS [ ]).
For an illuminating experience, try grep -ir word /usr/src/linux, where word is one of the following: fuck, shit, damn, hack, kludge, ":-(", "no idea", awful, stupid, and of course XXX... I'm sure you can think of your own candidates.


(From TurboPascal): My favorite bit about TurboPascal was in the manual for the editor. Sure it was fast, and usable and cheap, etc! And I loved it for that, but I still recall being most tied to one line in the manual about search and replace options:
	gnu	Search out and replace without asking all small antelope-like creatures.
MTO
Javadoc for a class:

Sorry for my laziness.
In my second year of college, I wrote a program to optimize neural net training with a genetic algorithm. Apparently I was inebriated at the time I wrote this, because my code, while correct, had some of the strangest comments I have ever written. I honestly don't know what I was thinking when I wrote some of them. Some of them I recognize as script references, but I have no idea what they were trying to convey.

  /* And now, ladies and gentlemen, the chord from HELL! */

  /* There are dumber f**ks than me out there, but not many */

  /* These clothes are a little tight, but the price was right */
  "Nostradamus told me this would happen. Smug bastard."
Sometimes I worry about myself. -- DaveFayram

"These clothes are a little tight, but the price was right" is a reference to Final Fantasy VI.
Here are excerpts from some code I've found myself having to upgrade to a new server structure.

	#include <wchar.h> //I hate strings.
	#include <tchar.h> //I HATE STRINGS!!!
	#include <string> //I HAT TEH STRINGES!!! DIE! DIEDIE! DIE!!!!!!

/// A class for interfacing dotnet code with (product)'s plugin API. /// As you may have noticed, making .NET code work with API code is a /// pain in the ass, because it never occurred to Microsoft that .NET code /// might one day have to exist on the same computer as API code. As /// unbelievable as it is, programmers need to have their non-.NET software /// [use] functions that were written in managed code. So, to better the meet the /// needs of their developers, Microsoft made the process as inconvienient /// as they possibly could. Enjoy.

/// This function converts stuff from a .NET String to an LPTSTR. /// May whoever decided it should be this complicated be required to /// write it 20,000 times on a tiny whiteboard with perfect penmanship, /// rot in jail for two years, then have to try clean it all off using /// nothing but his own saliva and a toilet brush without getting any /// ink on his gloves.

	public const string HTTP_USER_AGENT = "Dancing squirrels with teletype machines.";

LPWSTR Name2 = Name; //shoot me now - seriously

	//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...

A colleague, under some protest and considerable time pressure, had to convert a fairly simple flat-file-based configuration routine to a checksummed, binary mini-database in order to prevent users from abusing its contents. The file extension he used was ".cdb", which made sense once you saw that the "magic" identifier string at the beginning of the database file was "V31V3374" (or "Velveeta", an American brand of low-quality processed cheese).
The SWI Prolog interpreter responds to a query containing only an uninstantiated variable with:

	% ... 1,000,000 ............ 10,000,000 years later
	% 
	%	>> 42 << (last release gives the question)
Fans of the HitchhikersGuideToTheGalaxy will, of course, realize the significance of this. :)

-- CodyBoisclair
FreeBsd's "shutdown(8)". I think this must be newer than the historical reference (what, 1977, Steve Martin?), but I can't be certain off the top of my head, and don't feel like reading commit logs all night ;-) Comments mine.

 /* declaration, line 101 */

void die_you_gravy_sucking_pig_dog __P((void));

/* Called in 256-267 */

for (;; ++tp) { timewarn(tp->timeleft); if (!logged && tp->timeleft <= NOLOG_TIME) { logged = 1; nolog(); } (void)sleep((u_int)tp->timetowait); if (!tp->timeleft) break; } die_you_gravy_sucking_pig_dog(); }

/* and defined (initial portion) in 335-349 */

void die_you_gravy_sucking_pig_dog() { char *empty_environ[] = { NULL };

syslog(LOG_NOTICE, "%s by %s: %s", doreboot ? "reboot" : dohalt ? "halt" : dopower ? "power-down" : "shutdown", whom, mbuf); (void)sleep(2);

(void)printf("\r\nSystem shutdown time has arrived\007\007\r\n"); if (killflg) { (void)printf("\rbut you'll have to do it yourself\r\n"); exit(0); }

You can learn quite a bit about BSD philosophy from that last printf....
I once wrote this error dialog after the users annoyed me: "USER ERROR: Replace user and press a key to continue"
I once went through part of the MIT Scheme source code. In particular, wabbit.scm caught my eye. It appeared to be some obscure bit of the garbage collection system, and was full of names like WABBIT-SEASON-IS-OPEN, FUDD-THUNK, WABBIT-DESCWIPTOR, CALL-WITHIN-WABBIT-SEASON-WITH-DUCK-SEASON-RETURN-CONTINUATION, and KILL-DA-WITTLE-BUNNY-WABBITS.

My eyes glazeth over.

(The above source code is readable at http://github.com/tali713/mit-scheme/blob/master/src/wabbit/wabbit.scm as of May 2013.)
Found in a depracated .c file:

	/* fit round peg into square hole, if necessary...				*/
	/* well, actually any damn peg into whatever hole we have to work with...		*/
	/* use (the) force, if necessary					*/

Under "BUGS" on the xbiff man page: "The mailbox bitmaps are ugly." (which is literally true, btw)
Using Hungarian notation in C# is silly to begin with, but this takes the cake:

	public string m_sSourceGroup;
	public int m_iHops;  // Where you get pancakes
	public int m_iDepth;

In another incarnation, sometime in the late 1970s, I found the following comment in the Burroughs B1700/B1800 MCP's Memory Manager source:

  Ode to ARM040

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.

Found in (my own) comments in a program, after an unusually detailed explanatory comment -

 * (I never trust internal program documentation)

And in another one.

 * I do not think this should happen -
 * (Looks like a desperation sledge-hammer catch-all redundant
 *	un-refactored solution implemented rabidly during testing)

The documentation was right this time. -- PeterLynch
In a source code comment:

 // Either the app is exiting or the world is coming to an end.
 // Take your pick.

Some hairy code to dynamically position UI elements on arbitrary displays was preceded with this gem:

 // I'd trade my office mate for a layout manager.

From the release notes for the first release of the CrayonFX, a color printer produced by LaserMaster? in the mid-90s:

 Some colored objects from some applications may not print as expected.

My favorite comment ever:

 ; /* If you think this is a mistake, think again. */

At my first job I saw this comment before some hairy code

 /* PB, is this right?  -- AW */

I just left it -- neither PB nor AW were around to ask anymore.
We sent the firmware of our device to the manufacturer in Japan who modified it to create the manufacturing tests. When we got it back I looked over it and had a surprise. They abbreviated their variables, but any variable that had the word "count" in it was abbreviated not by dropping the "ou" but just the "o". It was really hard to read that code with a straight face.
I once wrote a routine to kill all the child windows in a dialog and called it Commit_Infanticide. Unfortunately, since our code could be audited by clients, our QA manager made me change it to something less frivolous like Terminate_All_Children.
lisp/terminal.el in emacs 18 had some real winners. http://stuff.mit.edu/afs/athena/contrib/epoch/lisp/terminal.el

Someone got really annoyed at Unix terminal behavior. The final function in the file is especially tart!
From the Perl module Pod::Perldoc:

  while (<PFUNC>) {  # "The Mothership Connection is here!"

The following I found in the documentation for the C exit function, but I don't remember whose C manual it came in: "Returns 1 on error. But then, if it returns at all there must have been an error."
(ruby-22.2.2/ruby/util.c)
Found the following very funny typo today:
  // User has no right toe

Usually it's the programmers who shoot themselves in the foot.
In the Linux driver for the RIO modem:

	/*
Perhaps this explains this comment later in the same driver code, when handling inconsistent information from two or more links:

	/*
	 ** Lies will not be tolerated.
	 ** If any pair of links claim to be connected to the same
	 ** place, then ignore this packet completely.
	 */

Which is followed shortly thereafter by:

	if (Lies) {
		rio_dprintk(RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n", Lies);

(linux-source-2.6.22/drivers/char/rio/rioroute.c)
From http://svn.haeleth.net/pub/rlBabel/gloss.cpp

 template <typename T>
 class test_p: public std::unary_function<T, bool> {
	// Come quick! come quick! thou happy hour
	// When C++ doth closures get,
	// And gain thereby some modern power,
	// And all this clumsiness forget
	// (Though that may take a lifetime yet,
	// Since standards are so hit-and-miss) --
	// Till then, we're stuck with crap like this.
	int x_, y_;
 public:
	test_p(int x, int y) : x_(x), y_(y) {}
	bool operator()(const T& t) const { return t.test(x_, y_); }
 };

 LargeObjectDescriptor lobster;

' This little beauty was written to allow those stupid ' user's to undo thier cock ups.
  class CRepositoryMoronicExportInsteadOfImportItemDlg : public CRepositoryNewItemDlg

Seen in a Crestron data file...

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

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

	This is an interesting if...

if (this.DdlPopList?.SelectedIndex? != 0) { this.DdlPopList?.SelectedIndex? = this.DdlPopList?.SelectedIndex?; }

  TokenIterator? tit;

Seen in the Perl package Pod:Simple

	# should never ever ever ever happen
	DEBUG and print "AYYAYAAAAA at line ", __LINE__, "\n";
	die "SPORK 512512!";

	#define cerr if(false)cerr

That, although a hack, certainly seems a clever one for disabling the error message output stream in a manner such that the compiler can cut it out as dead-code.
	public boolean isDirty() {
	// why do you always go out and
	return dirty;
	}

reminds me of this from something I'm working on at the moment:

	class Action { // lawsuit

The new GoogleCodeSearch is a great place for finding this stuff.
From my Web programming final project, in C#, after a 3-day marathon of Suzumiya Haruhi:

 SqlConnection? ConnectThisShit? = new SqlConnection?();
 SqlCommand? Kyon = new SqlCommand?(); // Kyon, the one who commands Haruhi
 SqlDataReader? YukiNagato? = new SqlDataReader?(); // Nagato, who spends all her time reading

Eh... I don't think you should be the one to judge that which you yourself wrote.

[The above has inspired me to give, from now on, an unconditional 'F' to any student assignment that uses unclever anime and/or Japanese novel references in comments, or worse, in variable names.]

Your reluctance to accept other people's notions disqualifies you for the role of giving grades. To the author of the code: I was smirking while reading the code.


I wrote in a nice StarTrek reference in a Python unit test module:

  class goesNowhere(object):
	def doesNothing(self):
	pass

As you might expect, the purpose was to reference a do-nothing method of a class, aptly named goesNowhere().doesNothing. --Samuel A. Falvo II
  typedef int16 TYPE;  /* Type of something */

Code that puts multi threading to good use: Thread.Sleep(700); // give the illusion that something significant happened
So we had this class, among the instance properties of which was a reference to an output stream that it would ultimately send - effectively - itself down.

The recipient then typically reset that stream to point to a new destination. However, it was typical for the old stream to need cleaning up (exactly how, needless to say, woud vary from stream type to stream type), so setting a new stream would begin by telling the old stream to do this.

So before the stream for the object to go down could be set, it had to be made ready. ReinitialiseOutputStream?()? Nah...:

  public void ReadySetGo?()

A few months ago i was programming a class that would update all customers records, as a decent programmer i commented my work as substantialy needed,

public string releaseFilter(string currentUserName) { //This part needs updating ............ }

I of course puut that there to remind me where i was the next day, when i returned...

public string releaseFilter(string currentUserName) { //You need updating switch to C++ noob; ............ }

Why is a c++ programmer adding an end statement to a comment,what a "noob"!
Just a bit of shell...
  function comment(s)
  {
  	if (i_know_what_to_do_shut_up_i_dont_need_your_help_mode) {
  		return
  	} else {
  		return s
  	}
  }

Found a comment in an application we're currently maintaining. As well as a couple of paragraphs that said why the checkin existed and pointing the reader to other affected parts of the codebase it said

  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!

I should mention that this was checked in over two and a half years ago, and the author is no longer around. I guess if it works, don't fix it.
From the PostgreSQL code for transaction support routines:

  /*

  // so called accessors: misbegotten mutant stepchildren of getters/setters

	private enum Tristate {
	No,
	Yes,
	Ummm
	}

From AT&T's ast package:

	#if !_PACKAGE_astsa && !_YOU_FIGURED_OUT_HOW_TO_GET_ALL_DLLS_TO_DO_THIS_
		/*
		 * these are not initialized by all dlls!
		 */

extern Error_info_t _error_info_; extern Opt_t _opt_info_;

A junior programmer (but with a Master's degree in a Venezuelan university) once wrote:

for(k=1;k<10;k++) {
	if(k==1) { .... }
	else if (k==2){....}
	else if (k==3) {....}
...

}

-- it is very rude how you've approached this case.. and I don't see where is the problem. He should use switch instead of if(){} else if(){} but the logic is correct in my opinion. and I don't have a Master's degree in a Venezuelan university

The logic is correct; it's also pointless, unless there's something like a break statement somewhere in the ...'s.

I don't know about the logic, but I see often enough similar code written (or copy-pasted) by colleagues from India:

 for(coln = FIRSTCOLUMN; coln <= LASTCOLUMN; coln++)
 {
  switch(coln)
  {
	case FIRSTCOLUMN: <some stuff...> break;
	case SECONDCOLUMN: <some stuff...> break;
	<....>
	case LASTCOLUMN: <some stuff...> break;
	default: <error handling code> break;
  }
 }

Using the defined names you can reorder columns just by changing defines, but I still don't see the point. Naturally, I remove all this alien code and write a strafe forward <stuff> (without for and switch), which is more readable, easier to debug and maintain.... and - not surprisingly enough - works just fine.

And believe it or not, I have seen a lot of similar examples on MSDN.


Medisoft Vigor Interface documentation: "When multiple files share the same file name, their processing order is arbitrary with respect to one another, but the group will still be processed after messages w/a "lower" file name and before messages w/a "higher" file name." And it wasn't talking about subdirectories.
Apparently a past developer for OpenSim? had a bad day. Found in the DataSnapshotManager?.cs file:

	String[] annoying_string_array = config.Configs["DataSnapshot?"].GetString?("disable_modules", "").Split(".".ToCharArray?());
	foreach (String bloody_wanker in annoying_string_array)
	{
		m_disabledModules.Add(bloody_wanker);
	}

Also found:

	m_gridinfo.Add("Name", config.Configs["DataSnapshot?"].GetString?("gridname", "harbl"));

(harbl means "cat balls")

These were removed as of the 0.6.5 release.
	// Steve did not send attribute so happy creativity 
	// lets recreate it using available information
	// this logic should nod be here and I am waiting impatiently to throw it away

	/*
	The Knuth books are not in the office only for show; they help make
	loops 30% faster and 20% as readable.	*/

This was in a flash application;
	on (release)
	{
	gotoAndPlay(84112); //W/ Yours, asshole. Stay away from mine!
	}

I saw an unfamiliar process hogging CPU, so I googled it:

Does this mean it verifies if somebody "is an ass"? (It's an "L", not an "I", but it can look like an I in certain fonts.)

LSASS.EXE = "Local Security Authority Subsystem Service". It should be noted that there are versions out in the wild that certainly behave as asses i.e.: isass.exe Trojan/virus/whatever, and lsass.exe running in the wrong place = Trojan. I like your analogy of it deciding whether a person who attempts to logon is and ass or not! :)


function UselessErrorHandler?($errno, $errstr, $errfile, $errline) {
	return false;
}


I've written a few odd pieces of code, especially when working with the curses library.

getstr(name) //this looks dangerous but it isn't

Or this one...

if (b == KEY_UP) {
	if (i == 1) continue;
	else {
		 i--;
		 continue; //i know this use of continue looks bizarre
				//if you can think of a better way then write it yourself
...

something i do to piss off my java teacher is to write

public static void main(String[] iHateYourClassAndAnythingILearnIHopeYouAreArrestedForEmbezzelling)

or whatever i want

That doesn't piss off your Java teacher. That simply makes your Java teacher realise you're an idiot.

[Fighting abrasion with abrasion is like fighting a fire with more fuel, LOL]

{I'd write back to the student: "You will likely have to work for bosses who are even bigger assholes than me. Consider it practice."}
In a human resources tracking module:

MARITAL_STATUS = {'Trapped': _('Married'), 'Smart': _('Single'), 'Lucky': _('Separated'), 'Wise': _('Divorced')}


In the main internal header for a module in C:

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

By same programmer:

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

A standard include containing boolean value definitions doesn't exist for your platform and you can't rely on the numeric values of TRUE and FALSE being the common 1 and 0. Can you think of a better way to define reliable true and false values? I think your attention was supposed to be drawn to the comments.if its a standard compliant C compiler then 1==1 must be 1 and !(1==1) must be 0


Unix System V/286 bootstrap:

	mov $di, 0	;; never trust a micro


Gee, I don't suppose there's a Whovian on my team?

"Excuse me, would you mind not farting while I'm saving the world?"

"Oh, sweet Lord: I'm a walking doodle."

"Your kindness in this emergency is much appreciated."

"More hide and seek, Doctor? How disappointing. Why don't you come out and face me?"
"Have you looked in the mirror lately?"

"The bravery of idiots is bravery nonetheless." [Since the others were more-or-less apropos, this one really had me worried...]

"Pardon me your Majesty, you'll have to leg it out of a window."

"Human?"
"Yeah - is that optional?"

"I think I understood some of those words - enough to know that you're completely potty."

"How is 'Harvey Wallbanger' one word?!"

"Just tell me one thing: what do you need those children for?"
"What are children ever needed for? They're a workforce."

"'Surveillance'. You ask me it's just another way of saying 'Go sit at the back of the class with the safety scissors and glitter.'"

"Oh, I'm thick! Look at me - I'm old and thick! Head's too full of stuff, I need a bigger head!"

"Now that's lovely - look at that: absolutely beautiful. 'Love from Donna'. Did you keep the receipt?"

"We're in some sort of no-place. The Silent Realm. The Lost Dimension."
"Otherwise known as London."

"You have a time machine, what do you need museums for?"
"Wrong! Very wrong! Ooh, one of mine! Also one of mine..."
"Oh, I see. It's how you keep score."

"I can't turn it off!"
"That's because I locked it, idiot."

"Time to run again? Love the running!"

Freudian slip typo: variable name was supposed to be "batchSize", but was keyed in as "botchSize".
Comment spotted: "This routine is intentionally poorly documented for security purposes."
 // Had to do this because DB is in Abbie Normal Form

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

Seen in Macintosh resource fork "In Flippin Pig Mode Again" Pig mode is a real thing. http://www.eeggs.com/items/497.html
 Congratulations!  You are reading the README file for a software
 package you downloaded!  You are now officially an *advanced* software
 installer.

Analyzing a tracker I just run through the following 15 years old code:
 BOOL fMicrosoftMakesBuggyCompilers = FALSE;  // actually I would like this to be true
 if( <condition 1> )
 {
  fMicrosoftMakesBuggyCompilers = <expression 1>;
 }
 else if( <condition 2> )
 {
  fMicrosoftMakesBuggyCompilers = <expression 2>;
 }
 if( fMicrosoftMakesBuggyCompilers )
 {
  <lots of statements>
 }
And there is no else branch for the last if-statement...
Buttons of two sizes (main command buttons and ancillary commands) in a GUI panel; distinguished in the code by whether they're a "BiggerButt?" or a "SmallerButt?".

I won't ask what they name "titles".

A bureau named "Population Management Bureau". Intended to mean along the lines of disaster recovery assistance. However, jokes about vasectomies won't stop. DilbertIsNoJoke.
"Awaiting vendor component here for hookup. I give it 1:5 chance of arriving on time, unless the brass gets on the horn." (And no, it was not healthcare.gov)
In Visual Basic

 On Error GoTo Hell
  ' Logic
 Hell:
  ' Code for handling the error is entered here. 
 End If


See: BadCode, EvilCode, BadProgrammer, KludgeItTillItWorks, ProgrammingPuns, WeirdErrorMessages

CategoryHumor, CategoryDebugging, CategoryWikiFavorites

EditText of this page (last edited November 19, 2014) or FindPage with title or text search