你遇到过的源代码中最好的注释是什么?


当前回答

刚从大学毕业的我渴望亲自动手。我的第一个任务是……“为我注释此代码”。

傻瓜。

过了一段时间我就厌倦了……

// this function doesn't actually calculated the profit, like it says --it really signals the mothership orbiting saturn that the planet is ripe for takeover

[later]

// I don't think anyone is going to read this

[various permutations on that last one]

其他回答

在linux 1.0内核调度器(schedule .c)中:

Dijkstra可能讨厌我。

/*
 *  'schedule()' is the scheduler function. It's a very simple and nice
 * scheduler: it's not perfect, but certainly works for most things.
 * The one thing you might take a look at is the signal-handler code here.
 *
 *   NOTE!!  Task 0 is the 'idle' task, which gets called when no other
 * tasks can run. It can not be killed, and it cannot sleep. The 'state'
 * information in task[0] is never used.
 *
 * The "confuse_gcc" goto is used only to get better assembly code..
 * Dijkstra probably hates me.
 */
asmlinkage void schedule(void)

(…)

//这将为我们每个用户节省0.5秒,并取悦机器精神。

在很长的程序之前:)

//This code sucks, you know it and I know it.  
//Move on and call me an idiot later.

我记不清了,大概是这样的:

Person p = new Person("John", "Doe", "male");
Collection women = new ArrayList();
women.insert(p.getTail());

这是肮脏的代码;)