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


当前回答

我最喜欢的是这样的

 # commented out
 ...
 ### end of the formerly uncommented #2001-02-22 John Doe

其他回答

从一个遗留的Perl CGI脚本:

# This is convoluted and evil, sorry.
aComment = 'this is not aComment' # this is aComment
class T(object):
    def f(this):
        this is not aComment

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

(…)

// Oh crap, i think i'm gonna yack

随后不久又有:

// TODO: end this lunacy
long long ago; /* in a galaxy far far away */