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


当前回答

在拉丁语中,从但丁的《神曲》中进入这里的人,请放弃希望。

其他回答

来自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。

Dennis M Ritchie在这里有一个关于一些古老UNIX注释的页面

我只是在一个非常简单的大学课程测试c++程序中碰到了这个。

我在评论一个类。

在析构函数中…

// Choose! Choose the form of the Destructor!
// The choice is made! The Traveler has come!

大约10年前,我从事图像处理工作,通过扫描显微镜视频帧来检测细胞运动。我当时在做一个特别复杂的工作,决定和朋友出去喝一杯。当我回到家时,我工作了一会儿,但没有太多,因为我喝醉了。第二天早上,我发现了一个10行完全混乱的函数,带有以下注释(显然是我自己写的):

/* Ah ah ah! You'll never understand why this one works. */

最奇怪的是,它竟然起作用了。

大概30页的xslt的中间部分

<!-- Here be dragons  -->