你遇到过的源代码中最好的注释是什么?
当前回答
我最喜欢的是这样的
# commented out ... ### end of the formerly uncommented #2001-02-22 John Doe
其他回答
// TODO: not this
上面写了一个同事迫切需要优化的查询。替他说句话,当时我们几个月都是每周工作70个小时……
我在一个充满显式怪异类型转换的函数中见过这段代码:
// Since today's CPUs are really fast, this is dedicated to those who said:
// " You can't use Moore's Law as an excuse to write bad software. "
代码太可怕了:)
// no comments for you
// it was hard to write
// so it should be hard to read
我曾经在一个用Paradox 3.5 -编写的大型预算系统工作多年后接到一个客户的电话
“我们在调试中遇到了一些注释”-
// This shouldn't happen, if it does, then the bits that automagically
// worked when I wrote it have stopped working
... !
/**
* 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";