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


当前回答

// somedev1 -  6/7/02 Adding temporary tracking of Login screen
// somedev2 -  5/22/07 Temporary my ass

其他回答

javascript函数的第一行:

// this part is more difficult

WTF?

有一些旧的javascript代码,写得很好。然后是一条评论线

// and there is where the dragon lives

接下来是一个功能,4个人花了一天时间来理解它在做什么。最后我们意识到它根本没用,什么都没有。

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++怎么样

// fix for groupid > 9 
// if groupid ever gets to 100 everything will break (again)

if (groupid < 10) {
groupid = "0" + groupid;
}
// Jay knows what's going on here, but will he remember in a year? Not very likely, this code sucks, but it works so do not change it.

这条评论被贴在一个巨大的“如果”区块上…哦,它操纵一个对象数组的对象数组的对象数组的字符串对象数组,可以是字符串或数字,取决于至少3个因素…(是的,我必须调试这段代码并更改它,我写了注释,但我没有写原始代码)。;)