你遇到过的源代码中最好的注释是什么?
当前回答
这是我自己代码中的一个,但它仍然非常有趣,我认为最好还是把它放在网上,因为它是在公共SVN中。
// These were orginally up and down. When it was clear the names were
// inapplicable, they were renamed to retain the joke.
// Sorry if you were hoping for useful variable names.
quantum strange, charm;
其他回答
在LKM中:
/*
* Dear Richard Stallman,
*
* This one's for you.
*
* Sincerely,
* Me
*
*/
MODULE_LICENSE( "GPL" );
/**
* As Gregor Samsa awoke one morning from uneasy dreams he found himself
* transformed in his bed into a gigantic insect. He was lying on his hard,
* as it were armour plated, back, and if he lifted his head a little he
* could see his big, brown belly divided into stiff, arched segments, on
* top of which the bed quilt could hardly keep in position and was about
* to slide off completely. His numerous legs, which were pitifully thin
* compared to the rest of his bulk, waved helplessly before his eyes.
* "What has happened to me?", he thought. It was no dream....
*/
protected static String DEFAULT_TRANSLET_NAME = "GregorSamsa";
// If I from the future read this I'll back in time and kill myself.
回到《Hitchhiker’s Guide》刚问世的时候,我曾经测试过某些内容是否可滚动,以及用户是否尝试着滚动,这是一种限制可变长度的语言。所以:
if (scroll and noScroll) # or tea and no tea
我不知道这是有趣还是悲伤..但是和我一起工作的一个实习生有这个小宝石来计算每个单位的价格
...
// get the units from the form
int numUnits = Integer.parseInt(request.getParameter("num_pieces")); // this break at random times
//price
float price = Float.parseFloat(request.getParameter("price")); // same as above
// Under certain conditions the following code blows up. I don't know those conditions.
float pricePerUnit = price / (float)numUnits;
...