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


当前回答

这是我今天重构一些代码时发现的一条评论

if( year < 100 ): year += 2000 #lol, Y2K

其他回答

   // Some wanker in ISO got rid of ifstream(int), ofstream(int), and
   // fstream(int).  Twit.
/*
    FIXME:  why the fuck did anyone ever think this kind of expensive iteration
                    was a good idea?

回到《Hitchhiker’s Guide》刚问世的时候,我曾经测试过某些内容是否可滚动,以及用户是否尝试着滚动,这是一种限制可变长度的语言。所以:

if (scroll and noScroll) # or tea and no tea
// John! If you'll svn remove this once more,
// I'll shut you, for God's sake!
// That piece of code is not “something strange”!
// That is THE AUTH VALIDATION.

你怎么看?下面的代码是安全的“svn删除”。

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

...

// 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;

...