There are several threads going on related to computer programming, so it seems there’s a fair body of coders on the board, so here goes.
Commenting code is an area frequently held up as an area many are deficient in (not “us”, of course, you know, it’s “those” programmers who lack for communication). So what are some of the strange, funny or flat-out useless comments you’ve seen out there? (Not counting S.O.P. stuff like leaving in huge blocks of commented-out code, or “TO DO” or “FIX LATER” type of comments from 1994 and the like.)
where source control checking told me “done today” was done 6 years ago.
Also, someone cryptically commented “IIAP” next to some major hack of a workaround, who was still around 5 years after it was checked in for me to go ask him what he meant. He’s a PhD. in CS and felt the need to confess to succumbing to deadline pressure to give in to a short-term quick-fix solution instead of designing in “the right way to do it”… and IIAP meant “I Am A Prostitute”.
I was recently asked if I knew FORTRAN, and when I grudgingly admitted I had some familiarity with it, was handed the following source code, which I am slowly converting to MATLAB.
C***************************
C
C MAIN 3DOF PROGRAM - ORIGINAL PROGRAM DEVELOPED KGN FOR {COMPANY}
C REF: KGN, "SPEED3D COMPUTER CODE DOCUMENTATION"
C A8094GZ 14 APRIL 1970
C
C ** DOCUMENTATION OF MAJOR CHANGES **
C
C 07/69 KGN 3D POINT MASS TRAJECTORY PROGRAM
C ??/72 LLP MODIFIED FOR MISSION SAFETY ANALYSIS
C 12/73 LLP CHANGED RANGE CALCULATION AND STAG POINT VEL GRAD
C {and so on through the decades before I was born...}
Later on the code contains jewels of obscure wisdom like
I think the most useless comments I’ve seen is stuff where the programmer will do things like:
int x, y; //Variables
int t1, t2, t3; //For T
int m1, m2; //M
int n1, n2, n3; //N
…two thousand lines of uncommented code
//#####!!! CHANGED 2005/8/10 !!!#####
…one line of uncommented code…
//#####!!! END CHANGED 2005/8/10 !!!#####
…eight thousand lines of uncommented code…
//#####!!! CHANGED 2005/7/22 !!!#####
…one line of uncommented code…
//#####!!! END CHANGED 2005/7/22 !!!#####
…eight thousand lines of uncommented code…
//#####!!! CHANGED 2005/8/30 !!!#####
…one line of uncommented code…
//#####!!! END CHANGED 2005/8/30 !!!#####
…eight thousand lines of uncommented code…
//#####!!! CHANGED 2005/8/20 !!!#####
…one line of uncommented code…
//#####!!! END CHANGED 2005/8/20 !!!#####
…eight thousand lines of uncommented code…
//#####!!! CHANGED 2005/7/12 !!!#####
…one line of uncommented code…
//#####!!! END CHANGED 2005/7/12 !!!#####
…eight thousand lines of uncommented code…
//#####!!! CHANGED 2005/8/3 !!!#####
…one line of uncommented code…
//#####!!! END CHANGED 2005/8/3 !!!#####
…eight thousand lines of uncommented code…
//#####!!! CHANGED 2005/8/15 !!!#####
…one line of uncommented code…
//#####!!! END CHANGED 2005/8/15 !!!#####
…eight thousand lines of uncommented code…
//cleanup
…three thousand lines of uncommented code…
//#####!!! CHANGED 2005/8/15 !!!#####
…one line of uncommented code…
//#####!!! END CHANGED 2005/8/15 !!!#####
…three thousand lines of uncommented code…
:smack:
The key bit to the :smack:-ness being that these were projects that I knew only had one coder… Do you really need to know when you made every single change?
This is one I only heard about second hand, about a fellow student programmer working for the computer center when I was in college, who wrote a long, complicated program (in Pascal) which contained exactly one comment:
count := count + 1 {increment count}
(“Real programmers don’t comment. If it was hard to write, it should be hard to understand.”)
The embedded code I’m working with now has been touched by dozens of programmers and is getting pretty old and tangled. There are lots of variations of these comments:
sleep(2); // Delay here fixes problem - don’t know why
I once heard about a large computer program written by a single person without any comments except one. One line, initializing a variable, said:
Var1=1770 ;RIP LVB
Nobody could figure out what it meant relative to the source code until someone remembered that the programmer was a big fan of Beethoven, who born in 1770.
1827 decimal == 723 hex, fighting ignorance and all that.
This is from a large and ancient program I get to maintain.
/****************************************************************************/
/* */
/* Function: MAIN */
/* ============== */
/* */
/* This is the main function where the program is initiated. It reads */
/* the parameters passed from PARAMFORM1. */
/****************************************************************************/
main(argc,argv)
int argc;
char *argv[];
{
Whoa, you don’t say? It is largely un-commented but there’s the occasional thing like:
I keep a list of funny and/or interesting comments in our source code at work.
One of the funnier ones came from a programmer who was fighting a compiler bug. For whatever reason, the compiler would not compute (expression 1)+(expression 2)+(expression 3)+(expression 4) correctly, no matter how it was written. So, she wrote:
/* begin stupid code /
/ You should be able to do this all in one line but it JUST WON’T WORK! /
X1 = expression 1
X2 = expression 2
X3 = expression 3
X4 = expression 4
X = X1+X2+X3+X4;
/ end stupid code */
Some other gems I’ve found:
;changed placement to eliminate internal assembler error (don’t ask me why this works)
; NOTE: If we are primary and we have no backup unit, we have no business here
; in the first place because we will stick here until we either get a
; reply from the non-existant backup unit, or we become non-selected. In
; other words, we will stay fucked until hell freezes over.
; Don’t change this strange statement…it works.
;; ***** YOU ARE WRONG, INTERRUPT BREATH!!! *****
;; stupid computer
;; Hold onto your hokey hats fellow hitch hikers, we have just begun to HOKE!
Because this code was inexcusably and
unnecessarily cryptic as well as ignorantly and
pathetically (un)commented, these comments may or may
not be competely accurate! Many thanks to the original
writers and subsequent non-contributers!
AHHHHHHHHH… I’ve been wanting to say that for years.
You know, Every time I looked at this code I…
well… never mind, enough said, back to work!
** Our mission (should we decide to accept it) is to
** empty both queues, and in the case of the data requests,
** stuff the new data in the database. Of course if you
** are caught or killed, the Secretary will disavow any
** knowledge of your actions. This program will self-
** destruct in 60 seconds… pffffttt…
‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
‘There are some subroutines that are far too
‘complex to explain in a short Rem statement. But
‘They work just fine anyway. This is one
‘of them.
‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
And, funnily enough, some code I work on does have constants that seem to spring out of the same mind that wrote the two you show. It goes something like:
Global Const NUM_ROW_UNO = 1
Global Const NUM_ROW_DOS = 2
Global Const NUM_ROW_TRES = 3
Global Const NUM_ROW_CUATRO = 4
Global Const NUM_ROW_CINCO = 5
Global Const NUM_ROW_SEIS = 6
(it’s in spanish. And it goes up to 28)… :rolleyes: and it’s for Visual Basic
Well, it does give a new dimension to the term “global variable”.
Some of these entries remind me, yes, I have seen (and can see in an xterm right now if I want to) comments along the lines of “don’t move this #include… trouble”. And the sad thing is that it’s true. If I move the #include line up or down a few, such as to group it with other #include lines from the same library… I get trouble.
Thus, the comment doesn’t really count as “meaningless”, in that its warning is definitely still in full effect. On the other hand, no light was actually shed in the writing or reading of it.
Not exactly commenting, but in the world of absurdist coding, the guy I replaced at a software company had, during his travails as a would-be coder, added this gem to some demo code:
TRUE = 1;
I can only imagine his frustration when trying to deal with boolean function returns…
This isn’t exactly up to the standards of code in this thread, but there was a time when I looked at the source code of a website I liked, and the site’s creator had moved all the code down so that the only thing to display (without scrolling) was:
//an infinite number of monkeys on an infinite number of typewriters would eventually produce some code that looks like this.
Later in the program
//The monkeys’ code works.
Not comments but a fellow classmate wrote an entire c++ program (for class so it wasn’t all that big) with no line breaks and had changed all the reserved words into vegetables or something to do with food (ie ‘=’ was ‘eats’). Setting a variable to a value looked like ‘tomato eats onion’. I may even have that somewhere. Beautiful.