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


当前回答

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

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

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

其他回答

# Don use this. Never!
// (c) 2000 Applied Magic, Inc.
// Unauthorized use punishable by torture, mutilation, and vivisection.

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

我不知道这是有趣还是悲伤..但是和我一起工作的一个实习生有这个小宝石来计算每个单位的价格

...

// get the units from the form 
int numUnits = Integer.parseInt(request.getParameter("num_pieces")); // this break at random times

//price 
float price = Float.parseFloat(request.getParameter("price")); // same as above

// Under certain conditions the following code blows up. I don't know those conditions.
float pricePerUnit = price / (float)numUnits;

...
try {

}
catch (SQLException ex) {
    // Basically, without saying too much, you're screwed. Royally and totally.
}
catch(Exception ex)
{
    //If you thought you were screwed before, boy have I news for you!!!
}
when :orientation
## Avoid matching gay people with straight people - they hate it, they do, they really do.
query_parameter = "(users.orientation = 'Bi' OR (users.orientation = 'Straight' AND users.gender IN ('#{user.opposite_genders.join('\',\'')}')) OR (users.orientation = 'Gay' AND users.gender IN ('#{user.same_genders.join('\',\'')}')))"

从一个约会网站…