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


当前回答

/*
* TODO: Remove this function

function remove($customer_id)
    {
        $this->Customer->remove($id);
    }

*/

其他回答

// StupidCompilerDontInline(SCDI), in the test project where
// allcode was in a single cpp the compiler had inlined nearly
// everything which lead to nice stackoverflow.
// To prevent this the metods are made virtual
#define SCDI virtual

在一个艺术资产导出工具中,我偶然发现了一个从数字(阿拉伯)到罗马数字的完整转换器。它是这样的:

/*
//You can tell I was bored
//I wanted to do this for a long time
char* ConvertToRoman(int number, int base)
{
... whole code here
}
*/

编写这段代码的人的团队已经处理了很长时间,我猜这影响了他们的理智。

Get This hack!

在一行汇编代码中,在几页未注释的代码之后。

我没有亲身经历过这种情况,但这是一个很好的故事(详见我的评论中的解释):

#define MSGTAG_B33R     0x723 /* RIPLVB */
/* This is O(scary), but seems quick enough in practice. */ 

后面是四个嵌套的for循环