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


当前回答

catch
{     
    // you’re fucked
    // write out the file somewhere and start screaming “Connection down! Connection down!”
}

其他回答

/* Only break the connection if it actually exists. It is important to
 * check the timeslot saved in the SOURCE of the disconnect message. */

我写了这条评论,现在我不记得为什么它很重要了…

// If you're reading this, that means you have been put in charge of my previous project.
// I am so, so sorry for you. God speed.

唐纳德·克努斯的另一个经典作品:

注意上面代码中的bug; 我只是证明了它是正确的,并没有尝试过。

不是一个评论,而是一个goto标签

ICantBelieveImUsingAGoto:

当我在高中上计算机课的时候,我们在一个普通的教室里上课——没有电脑。我们所有的测试都是在纸上完成的,一张纸上有一节课。我们的老师是第一次用c++授课,偶尔会在黑板上切换到Pascal模式。这很尴尬,因为我们中很少有人对学习帕斯卡感兴趣。

对于比课堂作业更大的作业,我们会在家里做,并提交代码和输出打印结果来评分。在提交了一些代码+输出输出后,我们共同意识到老师实际上并没有阅读代码-只是打印输出。为了测试我们的理论,我在代码的第三页放了一条注释——就在一些类声明之间:

// If you are reading this, please place a checkmark here [  ]

当然,我把它拿回来的时候,前面有一个大大的蓝色“a”,没有任何标记。