你遇到过的源代码中最好的注释是什么?
当前回答
当我在高中上计算机课的时候,我们在一个普通的教室里上课——没有电脑。我们所有的测试都是在纸上完成的,一张纸上有一节课。我们的老师是第一次用c++授课,偶尔会在黑板上切换到Pascal模式。这很尴尬,因为我们中很少有人对学习帕斯卡感兴趣。
对于比课堂作业更大的作业,我们会在家里做,并提交代码和输出打印结果来评分。在提交了一些代码+输出输出后,我们共同意识到老师实际上并没有阅读代码-只是打印输出。为了测试我们的理论,我在代码的第三页放了一条注释——就在一些类声明之间:
// If you are reading this, please place a checkmark here [ ]
当然,我把它拿回来的时候,前面有一个大大的蓝色“a”,没有任何标记。
其他回答
一些来自Linux内核的代码:
/* Sun, you just can't beat me, you just can't. Stop trying,
* give up. I'm serious, I am going to kick the living shit
* out of you, game over, lights out.
*/
-
/* 2,191 lines of complete and utter shit coming up... */
-
#if 0 /* XXX No fucking way dude... */
在PeopleSoft Financials PeopleCode的早期版本中:
/* I don't know how you can ever get here so I'll have to fix it later */
public static final void attachListener(Object listener) {
/* ======================= */
// This does nothing, continue searching
/* ======================= */
...
与听众一起痛苦!
rescue
# silently, we fail
# many validations fade
# like tear drops in rain
end
这只是众多案例中的一个……
v.bpc := v.pc; -- Remember to jump back
v.baccu := accu; -- Yo dawg, heard you like runing instructions
-- so I took backup of your accu so you can run
-- instructions while you run instructions.
v.flags.i := false; -- No more interupts
推荐文章
- 在构建中编写注释的语法是什么?gradle文件?
- Java注释中的/**和/*
- 有没有办法注释掉.ASPX页面中的标记?
- Jenkins:注释可以添加到Jenkins文件中吗?
- TypeScript注释的语法记录在哪里?
- CSV文件可以有注释吗?
- 什么是自文档化代码?它能取代文档化良好的代码吗?
- 在erb中添加注释的最佳方法
- 为什么Python没有多行注释?
- 我应该在批处理文件中使用哪种注释风格?
- 如何在Office VBA编辑器中注释和取消注释代码块
- “# noqa”在Python注释中是什么意思?
- 我可以向pip需求文件添加注释吗?
- 你遇到过的源代码中最好的注释是什么?
- 在Bash中创建多行注释的方法?