你遇到过的源代码中最好的注释是什么?
当前回答
/**---------START-----------**/
// IMPLEMENTATION GOES HERE
/**---------END-----------**/
但没有代码;)
其他回答
在大学的一次家庭作业中,一位老师特别坚决地要求我们注释代码:
//I wonder if she actually reads these.
当作业被返回时,在注释“是的,我愿意”旁边用红笔写着
从我最近从事的一个非常可爱的项目(是的,我承认,其中一些是我的,但我不会告诉你是哪个):
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
/*
* After 36 hours, 2 holes in my wall and writing my code right beside the API
* this still doesn't work.
* function getMap():void takes in an event object @param: evt:mouseEvent
* I will now retire for the day with a bottle of rum and 2 hours of crying
*/
Dennis M Ritchie在这里有一个关于一些古老UNIX注释的页面
我们的DBA在第三方编写的3000行存储过程中发现了这一点。
/* IF DOLPHINS ARE SO SMART, HOW COME THEY LIVE IN IGLOOS? */