你遇到过的源代码中最好的注释是什么?
当前回答
曾经有一个为我工作的程序员在他的代码中加入了“Style”注释,他在代码中编写了关于特定实现细节的内部争论,当他在某个特定的编码决策上被否决时,他就会离开。
例子:
的风格 '这是有争议的,但我传递图像句柄,而不是简单地 '传递缩放值,以保持调用代码更简单(通过a '一对声明语句)。或者,我可以传递这些数据 成员,但这将违反封装。
的风格 就像我在其他地方做过的一样,我将正式提出抗议 的表格),将注释序列化的实现视为 '一个属性,而不是一对Load/Save方法。这可能是 “风格的问题,值得商榷。
其他回答
int main(void)
/* Program starts here */
我猜它被病毒式传播了,我在一个守护进程(Linux)中发现了以下防止OOM杀手选择它:
/*
* Don't OOM me, bro!
*/
这紧跟在mlockall()之后,以防止进程交换,注释如下:
/*
* Don't swap me, bro!
*/
在1983年的COBOL中见过:
C I don't know what this next bit does so I'll jump around it
GOTO DONE.
从一个遗留的Perl CGI脚本:
# This is convoluted and evil, sorry.
/* Mark: If there's one thing you learn from this code, it is this...
Never, ever fly Air France. Their customer service is absolutely
the worst. I've never heard the words "That's not my problem" as
many times as I have from their staff -- It should, without doubt
be their corporate motto if it isn't already. Don't bother giving
them business because you're just a pain in their side and they
will be sure to let you know the first time you speak to them.
If you ever want to make me happy just tell me that you, too, will
never fly Air France again either (in spite of their excellent
cuisine).
Update by oej: The merger with KLM has transferred this
behaviour to KLM as well.
Don't bother giving them business either...
Only if you want to travel randomly without luggage, you
might pick either of them.
*/
推荐文章
- 在构建中编写注释的语法是什么?gradle文件?
- Java注释中的/**和/*
- 有没有办法注释掉.ASPX页面中的标记?
- Jenkins:注释可以添加到Jenkins文件中吗?
- TypeScript注释的语法记录在哪里?
- CSV文件可以有注释吗?
- 什么是自文档化代码?它能取代文档化良好的代码吗?
- 在erb中添加注释的最佳方法
- 为什么Python没有多行注释?
- 我应该在批处理文件中使用哪种注释风格?
- 如何在Office VBA编辑器中注释和取消注释代码块
- “# noqa”在Python注释中是什么意思?
- 我可以向pip需求文件添加注释吗?
- 你遇到过的源代码中最好的注释是什么?
- 在Bash中创建多行注释的方法?