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


当前回答

下面是一个必须声明的局部变量,只是为了将一个常量传递给库函数:

// This only exists because Scott doesn't know how to use const correctly

其他回答

Case 1:
   ...
   break;
   ...
//I don't want do do this but [my coworker] says it's part of the code standard
default:
   break;
// some sport psychology
if (!focused)
    Focus();

在20世纪80年代早期的某个时候,我们在PL/I中为公用事业编写财务建模代码。接到一个客户的电话,说代码在评论之后就爆炸了

/* Honest this works */

这家伙用了我们的标准金融方程花了大约15页的代数把一堆代码组合成一个方程。在三里岛事件后,当公用事业公司不得不以巨大的代价注销他们的核电站时,这个方程失败了,因为FIXED BIN 15(整数)溢出,如果代数没有发生,就不会发生这种溢出。

public int hashCode() {
//sucks, but what're you gonna do

/*
int hash = 7;
for (int i = 0; i < array.length; i++)
    hash = hash * 31 * (null == array[i] ? 0 : array[i].hashCode());
return hash;
*/

return 0;
}
// Any maintenance developer who can't quote entire Monty Python
// movies from memory has no business being a developer. 
const string LancelotsFavoriteColor = "$0204FB"