Fog Creek Software
Discussion Board




Funny comments

Hi, All!

Joel's article today reminded me something.
What is the funniest thing that you found in code comments?

Here is some chunk of Netscape code that I found on
http://www.salon.com/21st/feature/1998/04/13feature2.html

/*
* nesting deeper and deeper, harder and harder, go, go, oh, OH, OHHHH!!
* Sorry, got carried away there.
*/
struct lo_FormElementOptionData_struct {

At some point I had nothing to do, so I was reading JWZ's source of xscreensaver, an actually did find something funny there too:

static void
startup_ehandler (String name, String type, String class,
                  String defalt,  /* one can't even spel properly
                                    in this joke of a language */
                  String *av, Cardinal *ac)
{
  char fmt[512];
  String p[10];
  saver_info *si = global_si_kludge;    /* I hate C so much... */
  XrmDatabase *db = XtAppGetErrorDatabase(si->app);
  *fmt = 0;
  XtAppGetErrorDatabaseText(si->app, name, type, class, defalt,
                            fmt, sizeof(fmt)-1, *db);

  fprintf (stderr, "%s: ", blurb());

  memset (p, 0, sizeof(p));
  if (*ac > countof (p)) *ac = countof (p);
  memcpy ((char *) p, (char *) av, (*ac) * sizeof(*av));
  fprintf (stderr, fmt,        /* Did I mention that I hate C? */
          p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]);
  fprintf (stderr, "\n");

Michael K
Friday, February 01, 2002

somebody needs to teach jamie about vsprintf (:

Joel Spolsky
Friday, February 01, 2002

I hope you meant vfprintf or perhaps vsnprintf.

It's also perfectly possible that xscreensaver was written at a time when not everyone had fully compliant C89 compiler and libraries...

Fredrik Lundh
Saturday, February 02, 2002

I was working in Tech Support a number of years ago and ran across a problem with our product regarding dates (leap year, I think).

The code had been previouslly purchased from another company and the developer responsible for it for us spent about 5 minutes looking it over before he found the problem.

He said it was easy once he saw the comment:

/* Not really right */

John
Saturday, February 02, 2002

My favorite comment, which I've seen in some Microsoft source code:

/* IWDFWI */


Translation: It works, don't fuck with it.

Mike Gunderloy
Saturday, February 02, 2002

C code has so many kinds of interesting comments, doesn't it.

Following a more detailed discussion, this summary:
/*
*CBW - REMOVED HACK 27 OCT 1999 to add new hacks.
*/

And at the beginning of a badly written, complex routine, which had changed 'ownership' at least once:
/* I have no clue what this does, so stop asking me & go bug Rick. -Ryan */

Mikayla
Tuesday, February 05, 2002

I once worked with someone who had the old college textbook with the early Unix source code. One of the comments (buried somewhere deep in a presumably-tricky routine) was "You are not expected to understand this."

Steve Wheeler
Tuesday, February 05, 2002

Do a find/xargs/grep -i "f..k" on a Linux kernel code...

Andrzej Kocon
Wednesday, February 06, 2002

> You are not expected to understand this.

http://cm.bell-labs.com/cm/cs/who/dmr/odd.html

Fredrik Lundh
Wednesday, February 06, 2002

OK, my favourite one is "None of the programs in this monograph, needless to say, has been tested on a machine.", from "A discipline of programming", EWD, Prentice-Hall 1976, ISBN 0-13-215871-X. Btw., his manuscripts are available online (http://www.cs.utexas.edu/users/EWD, see the EWD-numbered documents link), and let me quote from EWD1305: "I don't need to waste my time with a computer just because I'm a computer scientist".

Andrzej Kocon
Thursday, February 07, 2002

From the source code for Origin's Strike Commander some years back (edited for prime time viewing):

/* This has to be the goat f*** hack of the century.  */

It also had one of my favorite crash messages (this was MS-DOS, remember).  Something like:

Strike Commander has unexpectedly ended.  You might find it convenient to reboot now.

Donavon Keithley
Sunday, February 10, 2002

Scritpting in PHP.
Had a lot of argument (sometimes pretty violent - I'm french, you know, we carry this in our DNA) with my project manager.
I was fed up to see his "narrow-minded" and "short-time-overlooking" point of view. He asked me *not to* code a function i *knew* the client would ask.

I decided to write the function anyway.

/* some day they will thank me for that */

Bruno Bord
Wednesday, October 01, 2003

*  Recent Topics

*  Fog Creek Home