你遇到过的源代码中最好的注释是什么?
当前回答
有一次,我问一个同事如何用我们的内部框架做一些事情(忘了具体是什么,一些晦涩的技术调用)。 他说“简单,看这里”,然后在他的编辑器中打开一个。java文件,在几页代码中间给我看了这个注释:
// HERE
我刚刚检查了一下,注释仍然在这个文件中:)
其他回答
TextBox1.Text = TextBox1.Text; //Point less yes, who writes this crap?
int main(void)
/* Program starts here */
我曾经想出了一个我认为很优雅的解决方案来解决一个特别棘手的问题,现在回想起来,这有点令人费解,并且大量使用了宏编程。多年以后,我从一个维护程序员那里发现了这条评论
/* Description: The Total Perspective Vortex derives its picture of the whole Universe on the principle of extrapolated matter analyses. To explain - since every piece of matter in the Universe is in some way affected by every other piece of matter in the Universe, it is in theory possible to extrapolate the whole of creation - every sun, every planet, their orbits, their composition and their economic and social history from, say, one small Macro. The man who invented the Total Perspective Vortex did so basically in order to annoy the IT department. Steve Weet - for that was his name - was a dreamer, a thinker, a speculative philosopher or, as some would have it, a slacker. And they would nag him incessantly about the utterly inordinate amount of time he spent staring out into space, or mulling over the mechanics of Chelsea FC, or doing spectrographic analyses of macros. "Have some sense of proportion!" they would say, sometimes as often as thirty-eight times in a single day. And so he built the Total Perspective Vortex - just to show them. And into one end he plugged the whole of reality as extrapolated from one macro, and into the other end he plugged the IT department: so that when he turned it on they saw in one instant the whole infinity of creation and theirselves in relation to it. To Steve Weet's horror, the shock completely annihilated ' their brains; but to his satisfaction he realized that he had proved conclusively that if life is going to exist in a Universe of this size, then the one thing it cannot afford to have is a sense of proportion. */
try
{
...
}
catch(Exception ex)
{
//if this happens the world is going to end...
}
现在猜猜发生了什么……
刚刚在一些Actionscript中发现了这个,我必须更新…
/*
* spaghetty code in this module.
* hardcoded variables for load paths for the content window.
* Needs (vast) improvement.
*/
..大:(