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


当前回答

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

其他回答

这是一个旧的IOCCC获奖条目,我不得不下载整个获奖档案——一个巨大的1.4 M——和grep的几个短语,我记得错了才找到它。

从语法上看,这可能不是注释。或许是这样。我还没想明白。它肯定没有注释分隔符,但也没有字符串分隔符。

C="Lint says "argument Manual isn't used."  What's that
mean?";

没有价格来猜测棉绒的产量。

对于好奇的人来说,这个条目在这里。

using namespace std;            // So sue me

在一个生成HTML的旧perl脚本中找到:

# I would be _very_ brain farting if I said this code didn't need reviewing.
# It will make babies cry, and hair grow on your back, so please don't use it

我曾经在一个项目中发现了这样的评论:

// Cabbage fart?

我不知道那是什么意思。还好我的魔方不在写它的人旁边。

private int mousycounter = 0; //Not really a counter