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


当前回答

高斯林的Emacs源代码中的ascii艺术头骨和交叉骨骼(这里很难重现)(警告说他编写的超热屏幕管理包不容易理解)。

其他回答

//这将为我们每个用户节省0.5秒,并取悦机器精神。

在很长的程序之前:)

在一个著名的商业DOS电子表格应用程序中:

/* This comment was just added in order to check-in a file that was last 
checked in by [Insert Programmer FirstName] "Back-to-the-Future" [Insert 
Programmer LastName]. While testing for year 2000 problems, he accidentally 
checked-in this file while his machine clock was set forward to the year 2000. 
This meant that the source code was always newer than the object file and 
compiled every time the code was built. I'm checking this file in again to 
fix that. */
-- Change Log:  Not needed. The code is perfect 'cause I wrote it.
-- If you change it, it will break.

我正在检查一些代码注释,以检查它们是否有意义,并看到上面的一行。

/* My lawyer told me not to reveal */

这是在PHP代码中找到的

$s=2; // chicken and bacon wrap for lunch

多么有用,幸运的是$s是不言自明的