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


当前回答

// Hard to explain

它最后也坏了。难怪很难解释清楚

其他回答

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

...

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

...

简单但有效的注释,在一些不太安全的c++代码之前

// yikes

这是在PHP代码中找到的

$s=2; // chicken and bacon wrap for lunch

多么有用,幸运的是$s是不言自明的

long john; // silver
//When I wrote this, only God and I understood what I was doing
//Now, God only knows