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


当前回答

我最喜欢的是已故的Paul DiLascia:

//作者:如果这段代码工作,它是由Paul DiLascia写的。如果不是,我就不知道是谁写的了。

其他回答

//Woulda
if(x) {}
//Shoulda
else if(y) {}
//Coulda
else {}
# dont question, i just felt like throwing some globals in
# this is actually quite pointless as youll soon see

稍后在代码中

#draw the circles (complicated)...dont question

更晚…

# complicated process of drawing the circles in a
# somewhat symmetrical, 3-d pattern
# dont question again

甚至以后……

# will determine if user clicks on die
# i determined these values...dont worry about them
// Any maintenance developer who can't quote entire Monty Python
// movies from memory has no business being a developer. 
const string LancelotsFavoriteColor = "$0204FB"
//ALL YOUR BASE ARE BELONG TO US

...这让我的老板以为有人黑进了系统。他不知道这个笑话。

有一次,我在另一个讨论中看到这样的内容:

// I can't divide with zero, so I have to divide with something very similar
result = number / 0.00000000000001;

聪明的解决方案,不是吗?(如果有人不确定,这就是个笑话)