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


当前回答

/* This is O(scary), but seems quick enough in practice. */ 

后面是四个嵌套的for循环

其他回答

在调试别人的JavaScript时,我看到了下面的评论:

// Notice: I feel so dirty doing this, but it's the only way to make it cross browser.

但在阅读Scott Hanselmen的一篇文章时,我看到了下面的引用,它与我在代码中发现的注释非常吻合:

Every line of code you write that you feel gross about will ultimately come back to haunt you. Therefore, avoid writing code that makes you feel dirty.

这很有趣。

// sometimes I believe compiler ignores all my comments
try {

} finally { // should never happen 

}

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

// This only exists because Scott doesn't know how to use const correctly
// THE LOOP THAT DO EVERYTHING!!!!!!!