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


当前回答

/* logic */
#ifndef TRUE
# define TRUE 1
#endif /* TRUE */
#ifndef FALSE
# define FALSE 0
#endif /* FALSE */
#define EOF_OK TRUE
#define EOF_NOT_OK FALSE

以及在IOCCC页面上的mkentry.c的其余部分。每次读这篇文章的时候,我都笑不出来。

其他回答

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 */

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

using namespace std;            // So sue me

发现了一个复杂的代码-

//耶稣和这段代码有一个共同点:都是复活的

在LucasArts的电脑游戏《the Eidolon》(游戏邦注:这款游戏本身就很古怪)的源代码中可以看到……

// He's dead, Jim!

一个可怕的解码补丁(意大利语翻译):

/**
*@return the value 
*@param key: the id of the list of instruments
*@PS this function is a violation of all the laws of the 
*software engineering, 
*commons sense, highway code 
*and ONU decision about the coding.
That sh*t...
*/