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


当前回答

// TODO: not this

上面写了一个同事迫切需要优化的查询。替他说句话,当时我们几个月都是每周工作70个小时……

其他回答

// This condition can't happen. Call the police or something.
try {
  dataSource.close();
}
catch (SQLException ex) {
  // Do nothing, since we're going to trash this anyway
}

当然,这类事情实际上是JDBC(或者至少是Oracle的JDBC驱动程序)中的wtf,因为它可以在关闭连接时抛出SQLExceptions…

在一个名为“Bar”的类中(这是一个不具有描述性名称的UI控件),类头文件:

/// <summary>I pity the "foo".</summary>

Remove()方法:

/// <summary>A "foo" and his money are soon parted.</summary>

更糟糕的是,业务合作伙伴从生成的文档中指出了这一点。更糟糕的是,这些可能是我们从那家伙那里得到的最接近有用文件的东西。

在初始化链表时:

last = first; /* Biblical reference */

简洁而滑稽。

我在一家大型投资银行看到,该银行要求记录和评论所有应用程序中断

Without a crash 

Or mighty bang 

The sync disk 

Did it's process hang