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


当前回答

这个注释位于一个包含接口的单元中,这些接口用于绑定主应用程序和各种第三方驱动程序之间的通信。

//**************************************
// Dear code maintainer:
//
// This source contains COM interfaces, not to be confused with interfaces 
// of any other sort, please do not just willy-nilly add additional methods 
// to these interfaces as they are truely immutable, unlike the interfaces 
// that other software vendors like Microsoft maintain.  IF you need to add 
// new functionality, then go thru the trouble of creating a NEW interface 
// and implement this functionality on only the objects you need.  
//
// While the money is good for fixing all of the problems caused by not 
// following the rules, I would rather work on things which actually have
// an impact on the future of the product rather than curse and yell 
// obsenities at the screen because someone didn't bother to understand the
// true meaning of IMMUTABLE.  
//**************************************

其他回答

http://fxr.watson.org/fxr/source/pci/if_rl.c 是好的来源。

// (c) 2000 Applied Magic, Inc.
// Unauthorized use punishable by torture, mutilation, and vivisection.

啊,我一直很喜欢这个……

回顾类中的旧代码很有趣……

    cardDeck.push_back(*(new card((rank)r, (suit)s)));  // Push each card onto the deck
                                                        // Temp. objects are overrated

在经历一些事情的时候,它让我希望我在凌晨4点随机编码的时候留下更多的评论……

在一个艺术资产导出工具中,我偶然发现了一个从数字(阿拉伯)到罗马数字的完整转换器。它是这样的:

/*
//You can tell I was bored
//I wanted to do this for a long time
char* ConvertToRoman(int number, int base)
{
... whole code here
}
*/

编写这段代码的人的团队已经处理了很长时间,我猜这影响了他们的理智。

来自Linux内核源代码:

linux /包括/ asm-i386 / hw_irq。h:

/*
 * subtle. orig_eax is used by the signal code to distinct between
 * system calls and interrupted 'random user-space'. Thus we have
 * to put a negative value into orig_eax here. (the problem is that
 * both system calls and IRQs want to have small integer numbers in
 * orig_eax, and the syscall code has won the optimization conflict ;)
 *
 * Subtle as a pigs ear.  VY
 */