你遇到过的源代码中最好的注释是什么?
发布于 2009-01-27 02:21:22
我对此特别内疚,在我的大多数项目中嵌入了非建设性的评论,代码诗歌和小笑话(尽管我通常有足够的判断力在发布代码之前删除任何直接冒犯的东西)。这里有一个我特别喜欢的,放在一个设计很差的“上帝物件”下面:
/**
* For the brave souls who get this far: You are the chosen ones,
* the valiant knights of programming who toil away, without rest,
* fixing our most awful code. To you, true saviors, kings of men,
* I say this: never gonna give you up, never gonna let you down,
* never gonna run around and desert you. Never gonna make you cry,
* never gonna say goodbye. Never gonna tell a lie and hurt you.
*/我很抱歉!我就是情不自禁...!
还有另一个,我承认我实际上还没有发布,尽管我很想在我的一个不太直观的类中这样做:
//
// Dear maintainer:
//
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
//
// total_hours_wasted_here = 42
// 发布于 2009-02-14 19:21:07
Exception up = new Exception("Something is really wrong.");
throw up; //ha ha发布于 2008-11-25 02:50:47
//When I wrote this, only God and I understood what I was doing
//Now, God only knowshttps://stackoverflow.com/questions/184618
复制相似问题