你遇到过的源代码中最好的注释是什么?
当前回答
//marco 2007.1.23
//I didn't do it
其他回答
我们有一个小组项目,使用最小-最大树创建一个Connect 4 AI。在我们的move-scoring函数中,我们让它为棋盘计算分数,在这段代码之上有这样的注释:
// This is kind of almost useless
但还有更好的。我们的导师给了我们一些他制作的粗糙AI的示例代码,并留下了很好的评论:
// We also add/subtract some points based on what's going on, on the bottom
// row. (I think this is retarded, but apparently when I coded this up
// back in 1999 I didn't.)
这个我在Python 2.5的“twisted”包中找到的(文件是tcp.py在第371行)
# Limit length of buffer to try to send, because some OSes are too
# stupid to do so themselves (ahem windows)
return self.socket.send(buffer(data, 0, self.SEND_LIMIT))
/*
* You may think you know what the following code does.
* But you dont. Trust me.
* Fiddle with it, and youll spend many a sleepless
* night cursing the moment you thought youd be clever
* enough to "optimize" the code below.
* Now close this file and go play with something else.
*/
这是我最喜欢的评论。
/// I intend to do this as shittily as possible because there are many better products that will totally blow this out of the water
/// and we don't have them so whatever
在后面的文件中,我们有更多的乐趣
/// sidestep a bug in WCF (that we can't send types across)
/// or, depending on how you look at, this issue is a Feature
稍后再讲
if( where == null)//be nice
//Abandon all hope ye who enter beyond this point
推荐文章
- 在构建中编写注释的语法是什么?gradle文件?
- Java注释中的/**和/*
- 有没有办法注释掉.ASPX页面中的标记?
- Jenkins:注释可以添加到Jenkins文件中吗?
- TypeScript注释的语法记录在哪里?
- CSV文件可以有注释吗?
- 什么是自文档化代码?它能取代文档化良好的代码吗?
- 在erb中添加注释的最佳方法
- 为什么Python没有多行注释?
- 我应该在批处理文件中使用哪种注释风格?
- 如何在Office VBA编辑器中注释和取消注释代码块
- “# noqa”在Python注释中是什么意思?
- 我可以向pip需求文件添加注释吗?
- 你遇到过的源代码中最好的注释是什么?
- 在Bash中创建多行注释的方法?