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


当前回答

在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)

(…)

其他回答

//Woulda
if(x) {}
//Shoulda
else if(y) {}
//Coulda
else {}
// Bad Christian, No cookie

这里的Cookie不是指浏览器Cookie

在拉丁语中,从但丁的《神曲》中进入这里的人,请放弃希望。

我在一个充满显式怪异类型转换的函数中见过这段代码:

// 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. "

代码太可怕了:)

private int mousycounter = 0; //Not really a counter