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


当前回答

try
{
...
}
catch(Exception ex)
{
//if this happens the world is going to end...
}

现在猜猜发生了什么……

其他回答

在LKM中:

/*
* Dear Richard Stallman,
*
* This one's for you.
*
* Sincerely,
* Me
*
*/
MODULE_LICENSE( "GPL" );
//If only humans could leave things be.

//Please do not edit this code, 
//if you do you wont go to jail, you wont go directly to jail, 
//you wont pass go, you wont collect 200 dollars

在调试别人的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.

这很有趣。

// (c) 2000 Applied Magic, Inc.
// Unauthorized use punishable by torture, mutilation, and vivisection.

啊,我一直很喜欢这个……

我所见过的最好的评论是

/* 
  There is no accounting for pointers 
*/