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


当前回答

'I hate nested regions and will delete them along with any code found in them.

其他回答

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

现在猜猜发生了什么……

我最喜欢的是这样的

 # commented out
 ...
 ### end of the formerly uncommented #2001-02-22 John Doe

#定义TRUE FALSE //快乐的调试傻瓜

首先,在一个大对象的更新的开始:

/*General note to all who tread in the <ObjectName>() code...
 * The SetOriginals() method from the BaseEntity class should be called (and only called) right after the Get() method
 * call as seen above.  Calling the SetOriginals method elsewhere will result in bugs and all kinds of other nasty suprises.
 */

然后在大约200行逻辑之后更新对象:

//Attempt to explain this confusing mess of code:
//First time you save an actual absence this is what happens:
//0. The first save saves to the <TableName> table (among other things). (Fig. A)
//1. The <CalculationMethod> method is called next which inserts to the <OtherTableName> table. 
//(This is the table that keeps track of credits to the case.) (Fig. B)
//2. So then you have to call <UpdateCalculations> to move the <TableName> records to the <ThirdTableName> table. (Fig. C)
//3. Then you go back and run calculations since you have the debits table (<ThirdTableName>) populated. (Fig D.)
//4. Then a final save to save the calculations back to the case. (Fig. E)
//Yeah, I know what you're thinking:  this sucks. 10/01/07 XXX

开发商是对的……这太糟糕了!

从泄露的Win2K源代码:

//这次黑客入侵的规模堪比国家债务的规模。