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


当前回答

有一次,我在另一个讨论中看到这样的内容:

// I can't divide with zero, so I have to divide with something very similar
result = number / 0.00000000000001;

聪明的解决方案,不是吗?(如果有人不确定,这就是个笑话)

其他回答

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

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
' Oh man I'm pissed. I think I better go home.

哪里喝醉了

//ALL YOUR BASE ARE BELONG TO US

...这让我的老板以为有人黑进了系统。他不知道这个笑话。

//MailBody builders for two outgoing messages
StringBuilder hanz = new StringBuilder();
StringBuilder franz = new StringBuilder();

当我读到这篇文章时,我仍然会笑出声来……