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


当前回答

int MyFunction()
{
    // There once was a man named Dave
    int Result = 0;

    // Whose code just wouldn't behave
    MyObject *Ptr = new MyObject();

    // He left to go to a meetin'
    Result = Ptr->DoSomething();

    // And left his memory a leakin'
    return Result;
}

c++怎么样

其他回答

Dennis M Ritchie在这里有一个关于一些古老UNIX注释的页面

顶部的:靠近单位顶部的:

// Oh what a tangled web we weave
// When first we practice to deceive
// ASTA

我最喜欢的是这样的

 # commented out
 ...
 ### end of the formerly uncommented #2001-02-22 John Doe
/* Jeez, this is an ugly mess */

...comment from the X11R6 internals source code circa 1991.

来自sendmail配置文件。一页又一页看起来就像线条噪音。我发现了这块宝石。

# insert this handy debugging line wherever you have problems
#R$*                $:$>99$1