你遇到过的源代码中最好的注释是什么?
当前回答
在一个著名的商业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. */
其他回答
在20世纪80年代早期的某个时候,我们在PL/I中为公用事业编写财务建模代码。接到一个客户的电话,说代码在评论之后就爆炸了
/* Honest this works */
这家伙用了我们的标准金融方程花了大约15页的代数把一堆代码组合成一个方程。在三里岛事件后,当公用事业公司不得不以巨大的代价注销他们的核电站时,这个方程失败了,因为FIXED BIN 15(整数)溢出,如果代数没有发生,就不会发生这种溢出。
不是注释,而是属性
[ThereBeDragons]
还有一个是我在IHttpHandler的实现中看到的
//What is this?
public bool IsReusable
{
get{return false;}
}
在一个生成HTML的旧perl脚本中找到:
# I would be _very_ brain farting if I said this code didn't need reviewing.
# It will make babies cry, and hair grow on your back, so please don't use it
if(m_measures =/*=*/ --index)
{
....
/*************************** Drag And Drop Section - Start (you should be me to mess with this section)*********************************************/