你遇到过的源代码中最好的注释是什么?


当前回答

来自Apache Xalan源代码:

/**
 * As Gregor Samsa awoke one morning from uneasy dreams he found himself
 * transformed in his bed into a gigantic insect. He was lying on his hard,
 * as it were armour plated, back, and if he lifted his head a little he
 * could see his big, brown belly divided into stiff, arched segments, on
 * top of which the bed quilt could hardly keep in position and was about
 * to slide off completely. His numerous legs, which were pitifully thin
 * compared to the rest of his bulk, waved helplessly before his eyes.
 * "What has happened to me?", he thought. It was no dream....
 */
protected static String DEFAULT_TRANSLET_NAME = "GregorSamsa";

进一步阅读The Daily WTF。

其他回答

// The following strings are meant to be funny.  Do not edit these strings
// unless you are funny, too.  If you don't know if you're funny, you're
// not funny.  If fewer than 2 people unrelated to you have told you that 
// you're funny, you're not funny.

我看到一些旧的fortran代码:

     integer *4 one,two,three;

c    asssign one to 100 before entering the loop
     one=100;

不是一个评论,而是一个goto标签

ICantBelieveImUsingAGoto:
// Catching exceptions is for communists

来自Mike Duncan在SQLite上的页面。

if(count<0) count=0;    //don't get me wrong but this has to be done :p