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


当前回答

long john; // silver

其他回答

%%return_median
hit_the_sweet_spot(Arg)->
.
.

我曾经参与过Windows 3.0的源代码。(我赶紧补充一句,作为一名微软员工,不是!)在那里,我遇到了一个文件加载器,它可以多次重新输入,并且有一个讨厌的双关语的例子(只是为了显示作者有多聪明)。

这些乱七八糟的可重入代码是用Intel程序集jmp指令(在C代码中间)执行的,它的标签是“we_are_not_in_kansas_any_more_toto”。

// Added because boss changed his mind : 20020111,20020501,20020820, ...
// Commented out because boss changed his mind : 20020201,20020614,20020908, ...

在ETL脚本之间的主要黑客RPG数据库和SQL Server一个。我大概有10到20次这样的评论……

    /* Mark: If there's one thing you learn from this code, it is this...
   Never, ever fly Air France.  Their customer service is absolutely
   the worst.  I've never heard the words "That's not my problem" as 
   many times as I have from their staff -- It should, without doubt
   be their corporate motto if it isn't already.  Don't bother giving 
   them business because you're just a pain in their side and they
   will be sure to let you know the first time you speak to them.

   If you ever want to make me happy just tell me that you, too, will
   never fly Air France again either (in spite of their excellent
   cuisine). 

   Update by oej: The merger with KLM has transferred this
   behaviour to KLM as well. 
   Don't bother giving them business either...

   Only if you want to travel randomly without luggage, you
   might pick either of them.
   */

我参与的一个大型项目在自动构建中使用了StyleCop和FXCop,并使用规则来防止人们检入带有未注释字段、方法、属性等的代码。

有些人对必须添加“获取或设置全名”之类的注释到自记录属性(如FullName)感到非常恼火,以至于他们不得不努力编写一个宏来绕过这些规则。

宏为方法、属性等插入了XML摘要标记,其中一个单一的不显示Unicode字符作为标记内容,这将欺骗构建规则,同时对为了注释而盲目坚持的东西进行轻微打击……

...至少直到他们引入了另一条规则来检查注释中的Unicode字符。