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


当前回答

//too much log will kill you

这个评论是我自己写的,当降低一些日志的优先级时,否则会写数百MB的垃圾,严重削弱应用程序的性能。

其他回答

从技术上讲,这不是一个评论,而是在凌晨2点左右编写的代码:

consent = False

... 该变量永远不会再次使用,并且出现在套接字的监听循环的开始。

catch (Ex as Exception)
{
     // oh crap, we should do something.
}

没有什么比一个空的catch块更能让人觉得代码是健壮的....

这是众所周知的,但我喜欢它(在sys/ufs/ufs_vnops.c中):

/*
 * A virgin directory (no blushing please).
 */

在FreeBSD内核源代码树中(甚至在之前,回到4.xBSD)

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

//ALL YOUR BASE ARE BELONG TO US

...这让我的老板以为有人黑进了系统。他不知道这个笑话。