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


当前回答

在一个项目中,我们有一个依赖ppwlib,当时它的FreeBSD端口有点糟糕,所以我不得不从源代码手动构建它。但它并没有立即起作用,我不得不研究代码;有一些复杂的类层次结构,部分代码是由宏生成的,其父类声明以它们开始

// The root of all evil ... umm classes

其他回答

这是在PHP代码中找到的

$s=2; // chicken and bacon wrap for lunch

多么有用,幸运的是$s是不言自明的

//Abandon all hope ye who enter beyond this point
/* You are not meant to understand this */ 

最初的《毁灭战士》拥有一个带有静态墙壁的引擎,但却不能移动;结果,所有的门都是垂直打开的;任何东西都不可能水平移动。当源代码发布后,我在查看代码时,在处理门的源文件中看到了这个,在一大块注释掉的代码的开头:

// UNUSED
// Separate into p_slidoor.c?

#if 0           // ABANDONED TO THE MISTS OF TIME!!!
//
// EV_SlidingDoor : slide a door horizontally
// (animate midtexture, then set noblocking line)
//

在JUnit API中找到:

/**
 * ...as the moon sets over the early morning Merlin, Oregon
 * mountains, our intrepid adventurers type...
 */
public Test createTest(Class theClass, String name) {
    ...
}