首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >你遇到过的源代码中最好的注释是什么?

问你遇到过的源代码中最好的注释是什么?
EN

Stack Overflow用户
提问于 2008-10-08 20:08:08
回答 505查看 3.1M关注 0票数 360

你遇到过的源代码中最好的注释是什么?

EN

回答 505

Stack Overflow用户

发布于 2009-01-27 02:21:22

我对此特别内疚,在我的大多数项目中嵌入了非建设性的评论,代码诗歌和小笑话(尽管我通常有足够的判断力在发布代码之前删除任何直接冒犯的东西)。这里有一个我特别喜欢的,放在一个设计很差的“上帝物件”下面:

代码语言:javascript
复制
/**
* For the brave souls who get this far: You are the chosen ones,
* the valiant knights of programming who toil away, without rest,
* fixing our most awful code. To you, true saviors, kings of men,
* I say this: never gonna give you up, never gonna let you down,
* never gonna run around and desert you. Never gonna make you cry,
* never gonna say goodbye. Never gonna tell a lie and hurt you.
*/

我很抱歉!我就是情不自禁...!

还有另一个,我承认我实际上还没有发布,尽管我很想在我的一个不太直观的类中这样做:

代码语言:javascript
复制
// 
// Dear maintainer:
// 
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
// 
// total_hours_wasted_here = 42
// 
票数 1.5K
EN

Stack Overflow用户

发布于 2009-02-14 19:21:07

代码语言:javascript
复制
Exception up = new Exception("Something is really wrong.");
throw up;  //ha ha
票数 1.1K
EN

Stack Overflow用户

发布于 2008-11-25 02:50:47

代码语言:javascript
复制
//When I wrote this, only God and I understood what I was doing
//Now, God only knows
票数 1.1K
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/184618

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档