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


当前回答

唐纳德·克努斯的另一个经典作品:

注意上面代码中的bug; 我只是证明了它是正确的,并没有尝试过。

其他回答

http://fxr.watson.org/fxr/source/pci/if_rl.c 是好的来源。

我一直很喜欢Paul DiLascia在他的文件头中写的:

// If this code works, it was written by Paul DiLascia. If not, I don't know
// who wrote it
when :orientation
## Avoid matching gay people with straight people - they hate it, they do, they really do.
query_parameter = "(users.orientation = 'Bi' OR (users.orientation = 'Straight' AND users.gender IN ('#{user.opposite_genders.join('\',\'')}')) OR (users.orientation = 'Gay' AND users.gender IN ('#{user.same_genders.join('\',\'')}')))"

从一个约会网站…

// The hackiest hack that ever did hack

它在WordPress博客引擎(wp-admin/includes/user.php -如果有人真的想看黑客攻击本身)。

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

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