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


当前回答

//The following 1056 lines of code in this next method 
//is a line by line port from VB.NET to C#.
//I ported this code but did not write the original code.
//It remains to me a mystery as to what
//the business logic is trying to accomplish here other than to serve as
//some sort of a compensation shell game invented by a den of thieves.
//Oh well, everyone wants this stuff to work the same as before.
//I guess the devil you know is better than the devil you don't.

其他回答

我继承了一个没有任何UAT交付给客户的项目。它被踢出了栅栏,要求赔偿。

他们第一次使用它,它自然就爆炸了。它是一个插入库,可以覆盖任何以文件名而不是文件描述符作为参数的系统调用。

许多系统调用已经被遗忘。

当我开始使用这款游戏时,它的代码包含了以下内容:

/* core dumps around here but this is hardly ever called */

and

/* don't know why this works but it seeems to be ok */

哦,没有单元测试。一位同事已经开始添加缺失的系统调用和单元测试。

编写代码的那些混蛋还在团队中,他们根本不在乎已经交付的垃圾!

// Singleton object. Leave $me alone.
private static $me;

我没有亲身经历过这种情况,但这是一个很好的故事(详见我的评论中的解释):

#define MSGTAG_B33R     0x723 /* RIPLVB */

我在查看TVNZ网站早期迭代的HTML源代码时发现了这个宝藏(如果你在家玩的话,从571行开始):

<!-- Hopfully we can do this otherwise the nav is going to be pretty plain and Hong will go postal. -->

我在我发布的WordPress模板中发布了这个“许可声明”。不管怎样,我觉得这很有趣。

/* The License:
You (from this point on referred to as The You) are hereby 
granted by me (from this point on referred to as The Me) 
license to knock yourself silly with this template. 
By using this template The You implicitly accepts this 
license and pledges solemnly to never claim creative 
ownership of any graphics, code, concepts, eggs, bacon, ideas, 
colors, shapes, hypertext-transfer protocols or other conduits 
of the visual splendor thatis this template. 

The Me, in turn, pledges equally solemnly to be far too 
lazy to ever check up on you, so if you do manage to pull 
some chicks The Me won't have a cow. 
However The Me would be sorely disappointed if The You 
were to try and sell or distribute this work without 
acknowledging The Me. Seriously. The Me will come down on 
The You like a large quantitiy of hard and heavy objects 
that in large quantities may be harmful and possibly even 
lethal to The You; So don't even think about it, The Buster.
*/