你遇到过的源代码中最好的注释是什么?
当前回答
public int hashCode() {
//sucks, but what're you gonna do
/*
int hash = 7;
for (int i = 0; i < array.length; i++)
hash = hash * 31 * (null == array[i] ? 0 : array[i].hashCode());
return hash;
*/
return 0;
}
其他回答
从我最近从事的一个非常可爱的项目(是的,我承认,其中一些是我的,但我不会告诉你是哪个):
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
来自一个显然在看巨蟒剧团的小伙子:
> //现在,for something完全 > // different: 类theLarch {
// I love the smell of dirty XML in the morning
xml = xml.Replace("xmlns=\"urn:bsd.orion/inventory\"", "");
我告诉学员至少做一些异常处理。这是我在每一个db调用....返回
Catch (Exception e) {
//eat it
}
/* logic */
#ifndef TRUE
# define TRUE 1
#endif /* TRUE */
#ifndef FALSE
# define FALSE 0
#endif /* FALSE */
#define EOF_OK TRUE
#define EOF_NOT_OK FALSE
以及在IOCCC页面上的mkentry.c的其余部分。每次读这篇文章的时候,我都笑不出来。