你遇到过的源代码中最好的注释是什么?
当前回答
我们的团队,就在今晚,发布了一个新版本的CSS文件,删除了一个文件的注释,该文件的结构是这样的:
@charset "UTF-8";
/* Who knew comments here could COMPLETELY ruin our page in Safari? */
body {
/* Really important stuff here */
/* Of course, comment or not, this will all get ignored by Safari because
its the first rule after the comments which break everything.
see http://www.w3.org/International/questions/qa-css-charset for the exact details!
*/
}
有趣的是,在网上你会发现人们的解决方案是输入一个虚假的元素作为字符集语句下面的第一条规则,然后被忽略,照常进行…
发人深省的问题:该把不评论的评论放在哪里?
旁注:我知道这是不需要的,因为头,元规则等。不幸的是,我们需要它作为一个catch all:(
其他回答
事实上,有一天我在一些代码上看到了这个,这些代码是在截止日期很急的时候写的。
//This was clearly written under duress
// Caveat implementor
这是我们在前雇主购买的智能卡产品中发现的唯一一条评论。一群荷兰密码学博士写的嵌入式C语言和汇编程序
// echt halmaal gek - no way!
(它的意思是“真的完全愚蠢”……这对我们也没有帮助)
i++; // increment variable i
在一个著名的商业DOS电子表格应用程序中:
/* This comment was just added in order to check-in a file that was last
checked in by [Insert Programmer FirstName] "Back-to-the-Future" [Insert
Programmer LastName]. While testing for year 2000 problems, he accidentally
checked-in this file while his machine clock was set forward to the year 2000.
This meant that the source code was always newer than the object file and
compiled every time the code was built. I'm checking this file in again to
fix that. */
推荐文章
- 在构建中编写注释的语法是什么?gradle文件?
- Java注释中的/**和/*
- 有没有办法注释掉.ASPX页面中的标记?
- Jenkins:注释可以添加到Jenkins文件中吗?
- TypeScript注释的语法记录在哪里?
- CSV文件可以有注释吗?
- 什么是自文档化代码?它能取代文档化良好的代码吗?
- 在erb中添加注释的最佳方法
- 为什么Python没有多行注释?
- 我应该在批处理文件中使用哪种注释风格?
- 如何在Office VBA编辑器中注释和取消注释代码块
- “# noqa”在Python注释中是什么意思?
- 我可以向pip需求文件添加注释吗?
- 你遇到过的源代码中最好的注释是什么?
- 在Bash中创建多行注释的方法?