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


当前回答

一段时间前我在一个PHP CMS中添加的注释。

if (/*you*/ $_GET['action']) { //celebrate

其他回答

  rescue
    # silently, we fail
    # many validations fade
    # like tear drops in rain
  end

这只是众多案例中的一个……

在20世纪80年代早期的某个时候,我们在PL/I中为公用事业编写财务建模代码。接到一个客户的电话,说代码在评论之后就爆炸了

/* Honest this works */

这家伙用了我们的标准金融方程花了大约15页的代数把一堆代码组合成一个方程。在三里岛事件后,当公用事业公司不得不以巨大的代价注销他们的核电站时,这个方程失败了,因为FIXED BIN 15(整数)溢出,如果代数没有发生,就不会发生这种溢出。

在JUnit API中找到:

/**
 * ...as the moon sets over the early morning Merlin, Oregon
 * mountains, our intrepid adventurers type...
 */
public Test createTest(Class theClass, String name) {
    ...
}

目前为止最好的一个:

"This code makes baby Jesus very sad!". 

它像这样引用一个String的初始化:

String blankSpaces="                              "+ //100 whitespaces
                   "                              "+ //200 Whitespaces
                   ...
                   "                                        " //100 whitespaces

你懂的。