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


当前回答

# There is a bug in the next line.  $searchParameters != {} will always return true, because {} is creating
# a new hash reference on the fly, and the inequality operater is comparing the memory location of it
# to the memory location of $searchParameters, and they will always be different. 
# This means that the following code will always get executed as long as $nodes is defined.
# I'm leaving it there because it has always been there, and although I'm sure it was originally meant to
# mean %$searchParameters (essentially "is this hash not empty"), I'm afraid to change it.
if ( $nodes && $searchParameters != {} )
{

其他回答

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

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

//我穿上长袍,戴上巫师帽……

DataRow[] foundrows = FilterCalendarEntriesBecauseDotNETIsFuckedUp(tbtemp,CalDate);

不是注释,而是一个有趣的函数名

从泄露的Win2K源代码:

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

我在一个充满显式怪异类型转换的函数中见过这段代码:

// Since today's CPUs are really fast, this is dedicated to those who said:
// " You can't use Moore's Law as an excuse to write bad software. "

代码太可怕了:)