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


当前回答

//Abandon all hope ye who enter beyond this point

其他回答

// (c) 2000 Applied Magic, Inc.
// Unauthorized use punishable by torture, mutilation, and vivisection.

啊,我一直很喜欢这个……

Many years ago (about 1994) I was working on a Oracle PRO*C application for a large multi-national software company that you will have heard of. The app I was working on was a massive Oracle application and they had a utility that ran overnight tidying up data and doing all sorts of aggregate calculations. Every time anything needed doing as a batch job, it got shoved into this utility and as you can imagine it became an absolute monstrosity. It was also notable for the tiny number of comments that it had for such a massive program.

它为数不多的评论之一仍然是我所见过的对纯粹的WTF的最好的评论……我试图在一个函数中找到一个bug,它有数百行长,中间是函数中唯一的注释:

/* I did this the other way */

直到今天,这仍然是我所见过的最好的评论。

我猜它被病毒式传播了,我在一个守护进程(Linux)中发现了以下防止OOM杀手选择它:

/*
 * Don't OOM me, bro!
 */

这紧跟在mlockall()之后,以防止进程交换,注释如下:

/*
 * Don't swap me, bro!
 */
# let's pretend we are free, for a while

在教室前面发现了这个。接下来是一个(天真的)实现ORM的尝试。我还是不明白他为什么这么写。

来自一个显然在看巨蟒剧团的小伙子:

> //现在,for something完全 > // different: 类theLarch {