你遇到过的源代码中最好的注释是什么?
当前回答
我们的团队,就在今晚,发布了一个新版本的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:(
其他回答
我刚刚注意到自己在写这个
// not brilliant solution, but fair enough heh.
来自Linux内核源代码:
linux /包括/ asm-i386 / hw_irq。h:
/*
* subtle. orig_eax is used by the signal code to distinct between
* system calls and interrupted 'random user-space'. Thus we have
* to put a negative value into orig_eax here. (the problem is that
* both system calls and IRQs want to have small integer numbers in
* orig_eax, and the syscall code has won the optimization conflict ;)
*
* Subtle as a pigs ear. VY
*/
我发现了这个:
I'm not sure what I did
// Catching exceptions is for communists
来自Mike Duncan在SQLite上的页面。
大约1997年,Netscape网络浏览器的UNIX风格的源代码:
/* HP-UX sucks wet farts from dead pigeons' asses */
不幸的是,在Moz开源之前,这些珍珠被移除了……
推荐文章
- 在VS Code中禁用“Comments are not allowed In JSON”错误
- Swift:理解// MARK
- 在构建中编写注释的语法是什么?gradle文件?
- Java注释中的/**和/*
- 有没有办法注释掉.ASPX页面中的标记?
- Jenkins:注释可以添加到Jenkins文件中吗?
- TypeScript注释的语法记录在哪里?
- CSV文件可以有注释吗?
- 什么是自文档化代码?它能取代文档化良好的代码吗?
- 在erb中添加注释的最佳方法
- 为什么Python没有多行注释?
- 我应该在批处理文件中使用哪种注释风格?
- 如何在Office VBA编辑器中注释和取消注释代码块
- “# noqa”在Python注释中是什么意思?
- 我可以向pip需求文件添加注释吗?