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


当前回答

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

其他回答

我喜欢GNU双utils中的一些注释。这个来自BFD som.c:

/* You'll never believe all this is necessary to handle relocations
   for function calls.  Having to compute and pack the argument
   relocation bits is the real nightmare.

   If you're interested in how this works, just forget it.  You really
   do not want to know about this braindamage.  */

这个也是:

/* Don't ask about these magic sequences.  I took them straight
   from gas-1.36 which took them from the a.out man page.  */

...

/* Keep track of exactly where we are within a particular
   space.  This is necessary as the braindamaged HPUX
   loader will create holes between subspaces *and*
   subspace alignments are *NOT* preserved.  What a crock.  */

另一个:

/* We will NOT put a fucking timestamp in the header here. Every
   time you put it back, I will come in and take it out again. ... */

从气体:

/* Yes this is ugly (storing the broken_word pointer
   in the symbol slot).  Still, this whole chunk of
   code is ugly, and I don't feel like doing anything
   about it.  Think of it as stubbornness in action.  */
//FIXME: fix this before the 1.0 release

他们在第4版

// this is really complicated

没有其他评论了

(A bunch of code that's really weird looking)  //Kludge.

其中最经典的是皮埃尔·德·费马对他著名的“大定理”所作的评论:“这一页的空白处太小了,无法写下证明。”

350多年后才找到证据。

(根据维基百科,这是原文:)

Cubum autem在双cubos, aut 二元象限 象限,和将军 无限超quadratum中的一无所有 在两种情况下 我们是恶魔 米拉比林健康。Hanc marginis exiguitas不是caperet。

...并翻译成英语:

(把立方体分开是不可能的 化成两个立方,或者化成四次方 2 / 4次方,或者一般来说,任意 幂大于二成二 喜欢权力。我发现了一个真正的 这是一个绝妙的证明 边际太窄,无法容纳。)