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


当前回答

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

我在评论一个类。

在析构函数中…

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

其他回答

最近在我们的代码中发现了这一点(我们开发企业软件):

// Instance of excel
Excel excel = this.CreateExcelInstance();
excel.Open(stream); // how to close it?!

在此之前,我确信我们已经摆脱了这些“有趣的东西”,我们正在以正确的、意识形态正确的方式做这件事……

大概30页的xslt的中间部分

<!-- Here be dragons  -->

在LKM中:

/*
* Dear Richard Stallman,
*
* This one's for you.
*
* Sincerely,
* Me
*
*/
MODULE_LICENSE( "GPL" );

我最喜欢的(我必须承认我用过很多次):

// Yes...I know this is repulsive and stupid.
// But <%CompanyOwnerOrManagerToken%>, not knowing a thing about code,
// demanded I do it anyways. SO, go crap on their desk, not mine.
// K THX BYE 

这是我们团队微观管理效果的一个活生生的例子:

// I am not responsible of this code.
// They made me write it, against my will.

... 我们敬爱的技术总监很喜欢把代码和编码指南都硬塞到开发人员的喉咙里(*)。

当然,当项目负责人寻找bug的原因时,发现它在“非最佳代码”中,他就不那么高兴了……

(*)当然,我指的是强大的VB国王……如果你想评估强大的VB国王的全部力量,你可以阅读下面的SO帖子:你被迫遵循的最奇怪的编码标准规则是什么?...