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


当前回答

public GetRandomNumber()
{
    // Chosen by a fairly rolen dice
    return 12;
}

其他回答

BerkeleyDB

/*
 * Chaos reigns within.
 * Reflect, repent, and reboot.
 * Order shall return.
 */
return (DB_RUNRECOVERY);
//I am not sure why this works but it fixes the problem. 

这是之前的一组代码,技术上确实解决了问题,它的意思是,但打破了其他3个东西....

在为一家芬兰移动网络设备制造商工作期间,我深入研究了硬件抽象层,发现芬兰语单词“puukko”出现了100多次。

“puukko”是一种万能刀,每个芬兰人的工具箱里或家里都有。它被用于从剥土豆到电脑维修(我的观察)的所有事情。我相信在这个语境中,它相当于芬兰语中的“Hack”。

我的芬兰同事否认了这一点,并说这更像是“外科手术/干预”……我差点就相信了,直到我看到下面的评论:

/* Perkele ISO Puukko! */ -> Fucking Big Hack!

“这永远不会发生”。

朋友,这是我的临终遗言……

试着在谷歌代码搜索中输入你最喜欢的脏话,它会消磨掉许多无聊的时间。以下是我最喜欢的例子:

/* These magic numbers are fucking stupid. */

/* Dear free software world, do you NOW see we are fucking
   things up?! This is insane! */

/* We will NOT put a fucking timestamp in the header here. Every
   time you put it back, I will come in and take it out again. */

# However, this only works if there are MULTIPLE checkboxes!
# The fucking JS DOM *changes* based on one or multiple boxes!?!?!
# Damn damn damn I hate the JavaScript DOM so damn much!!!!!!

/* TODO: this is obviously not right ... this whole fucking module
   sucks anyway */

/* FIXME: please god, when will the hurting stop? Thus function is so
   fucking broken it's not even funny. */

我个人最喜欢的

 # code below replaces code above - any problems?
 # yeah, it doesn't fucking work.