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


当前回答

我不止一次使用过这个方法,当我对一个数学公式做了一些不明显的简化时,我不想记录:

//this formula is right, work out the math yourself if you don't believe me

其他回答

我看到有人对代码的评论:

// This comment is self explanatory.

我猜他是想说“可变的”,但这个错误造成了一个有趣的评论……想想这里的循环逻辑,以及写它的徒劳。

/* logic */
#ifndef TRUE
# define TRUE 1
#endif /* TRUE */
#ifndef FALSE
# define FALSE 0
#endif /* FALSE */
#define EOF_OK TRUE
#define EOF_NOT_OK FALSE

以及在IOCCC页面上的mkentry.c的其余部分。每次读这篇文章的时候,我都笑不出来。

//I'm sorry, but our princess is in another castle.

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

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

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

// if the resultMap size is less than or equal to zero
// then the product is added
if (resultMap.size() <= 0)