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


当前回答

// The freshest corpse at the back please.
m_DeadCharacters.push_back( std::make_pair(character, 0.0f) );
// Get rid of the rotting surplus
while( m_DeadCharacters.size() > 3 )
    m_DeadCharacters.pop_front();

其他回答

在初始化链表时:

last = first; /* Biblical reference */

简洁而滑稽。

#!/usr/bin/sh
#       Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
#         All Rights Reserved

#       THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
#       The copyright notice above does not evidence any
#       actual or intended publication of such source code.

#ident  "@(#)false.sh   1.6     93/01/11 SMI"   /* SVr4.0 1.3   */
exit 255

从SunOS 5.9即Solaris 9获取(/usr/bin/false)

switch(value)
{
   [...]
default:
   ASSERT(**true**); // if this is triggered, something really bad is happening.
}
/* Jeez, this is an ugly mess */

...comment from the X11R6 internals source code circa 1991.

当我注释掉我认为不再有用的代码块,但我可能是错的(因此没有删除它们),我有时会在它们之前

// Wilted celery?

这个想法就像芹菜一样枯萎了,但你还是把它放回冰箱里。我只知道十年后会有人看到这些评论,说什么鬼?