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


当前回答

# dont question, i just felt like throwing some globals in
# this is actually quite pointless as youll soon see

稍后在代码中

#draw the circles (complicated)...dont question

更晚…

# complicated process of drawing the circles in a
# somewhat symmetrical, 3-d pattern
# dont question again

甚至以后……

# will determine if user clicks on die
# i determined these values...dont worry about them

其他回答

为了保护有罪的人,价值观被改变了

这是一个承包商留下的,他一直在做一段负责测试电子邮件登录的代码。我们不相信,所以我们试了一下,这是一个有效的登录到他的个人帐户;我们再次检查了修订历史,他有两个签入来编辑它:一个是添加代码,另一个是注释掉它。

我们只添加了美术内容,而不去管其他内容;另一名开发人员认为,用未来的自己给他发电子邮件(游戏邦注:比如《The Office》)会很有趣,他说,在登录停止之前,他每天都要发两周的电子邮件。

'    ROFL:ROFL:LOL:ROFL:ROFL
'        ______/|\____
'  L    /          [] \
' LOL===_      ROFL    \_
'  L     \_______________]
'            I      I
'        /---------------/

'TODO: REMOVE MY INFO AND REPLACE WITH USER CREDENTIALS
'Private TEST_LoginName As String = "DurgshA@Exmaple.org"
'Private TEST_Password As String = "Humsal892"
'Private TEST_Server As String = "imap.secureserver.net"

我最喜欢的部分不是他做了这件事,也不是他不小心把它留在原地等待签到——而是当他再次看到它时,他只是把它注释掉了,而不是删除它。如果我们不知道它在那里,我们就不会去看原始版本:-D

有一次,我在另一个讨论中看到这样的内容:

// I can't divide with zero, so I have to divide with something very similar
result = number / 0.00000000000001;

聪明的解决方案,不是吗?(如果有人不确定,这就是个笑话)

看这个:

'On Error Goto Hell.
// 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();

我曾经在一个项目中发现了这样的评论:

// Cabbage fart?

我不知道那是什么意思。还好我的魔方不在写它的人旁边。