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


当前回答

我记不清了,大概是这样的:

Person p = new Person("John", "Doe", "male");
Collection women = new ArrayList();
women.insert(p.getTail());

这是肮脏的代码;)

其他回答

public static final void attachListener(Object listener) {

/* ======================= */

// This does nothing, continue searching

/* ======================= */

...

与听众一起痛苦!

用于政府目的的企业等级系统中的评论

'RH 5/24/06 burn me if this dosn't work.. :)

好RH.....公司总裁/首席开发人员

来自一个显然在看巨蟒剧团的小伙子:

> //现在,for something完全 > // different: 类theLarch {

try {
  dataSource.close();
}
catch (SQLException ex) {
  // Do nothing, since we're going to trash this anyway
}

当然,这类事情实际上是JDBC(或者至少是Oracle的JDBC驱动程序)中的wtf,因为它可以在关闭连接时抛出SQLExceptions…

从我最近从事的一个非常可爱的项目(是的,我承认,其中一些是我的,但我不会告诉你是哪个):

if(FAILED(hr))
{
    char fuck[256];
    sprintf(fuck, "GetBuffer() fucking fucked the fuck: %d", hr);
    MessageBoxA(0, fuck, fuck, MB_OK | MB_ICONERROR);
    return;
}


// This is for Chris, since he gets all hot and horny over "uint" instead of "unsigned int"
// ... or maybe he's just a lazy fuck. Who knows!?
using Ogre::uint; 
// movable texts, fucktory
MovableObjectTextFactory* m_pMovableObjectTextFactory;


// diarrhea... shitting CR from the string. complete run...

他的意思是,他将字符串通过回车分开来呈现。

// unlock shit (duh, this comment is useless)
pixelBuffer->unlock();


// :HACK: remove me after demo is shipped
Of course, it's still in there ;)


// it's 4am and I can't think of a decent error message.
// my lead just fell asleep at his desk, so I can't ask him.
// [name] went home because he didn't want to get divorced.
// and so it's little ol' me, sitting here, comin up with an
// error message for something that should never ever happen.
ASSERT0(in_len == max_in, "http://www.youtube.com/watch?v=oHg5SJYRHA0"); 


// you want hungarian, you GET hungarian!
for(int fcknglpidxcntvrI = 0; fcknglpidxcntvrI < len; fcknglpidxcntvrI++)


bool bKillSomethingAlive = false; // beating the dead horse instead

当然,我们也有很多有趣的表达“Hack”的方法:

// HACKOMATIC 
// HMM... HACKXOR?
// HACK'O'ROONY
// AR; yeah I know it's HACKsoup
// HACK SHOT! DOMINATING!
// HACK'KIDO
// HACKku. sepukku. harakiri. kamikaze. ninja.
// HACK'o'NEIL
// HACKsaw