令人笑喷的 56 个代码注释,你写过多少?
来源 | 程序员的幽默
老衲不请自来,
给大家献上一波神注释
供施主们娱乐娱乐
0.
/** Dear Maintainer** Once you are done trying to ‘optimize’ this routine,* and you have realized what a terrible mistake that was,* please increment the following counter as a warning* to the next guy.** total_hours_wasted_here = 73*
亲爱的维护者
如果尝试对这段程序进行'优化'
并且您已经意识到这是一个多么可怕的错误,
请增加以下计数器的个数用来对后来人进行警告
这里总共浪费的时间= 73
1.
Exception up = new Exception("Something is really wrong.");
throw up; //ha ha
例外=新的异常("确实有问题。")
放弃; //哈哈
2.
// When I wrote this, only God and I understood what I was doing
// Now, God only knows
当我写下这个的时候,只有上帝和我明白我在做什么
现在,只有上帝知道
3.
// sometimes I believe compiler ignores all my comments
有时,我会相信编译器会忽略我所有的注释
4.
// I dedicate all this code, all my work, to my wife, Darlene,
// who will have to support me and our three children and
// the dog once it gets released into the public.
谨以此代码,献给我的妻子达琳,感谢她一直支持着我,以及我的三个孩子和一条狗。
5.
// drunk, fix later
喝多了,改天再修
6.
// Magic. Do not touch.
魔法!不要碰。
7.
// I'm sorry.
抱歉。
8.
return 1; # returns 1
返回 1;# 返回 1
9.
Catch (Exception e) {
//who cares?
}
捕获(异常e)
谁在乎?
10.
/**
* Always returns true.
*/
public boolean isAvailable() {
return false;
}
代码返回 false ,注释则始终返回 true
11.
/*
* You may think you know what the following code does.
* But you dont. Trust me.
* Fiddle with it, and youll spend many a sleepless
* night cursing the moment you thought youd be clever
* enough to "optimize" the code below.
* Now close this file and go play with something else.
*/
你可能相信你能看懂以下代码,
但是其实绝对不可能,相信我。
一旦你调试了,你绝对会后悔装聪明去尝试优化这段代码。
最好的方式是关闭文件,
去玩点儿你喜欢的东西吧!
12.
try {
} finally { // should never happen
}
绝对不会运行到这里
13.
const int TEN=10; // As if the value of 10 will fluctuate...
好像 10 的值会波动...
14.
// This code sucks, you know it and I know it.
// Move on and call me an idiot later.
这段代码的确很烂,我知道你也知道,
先不要骂我,请先接着往下看
15.
// If this comment is removed the program will blow up
如果删了此处注释,程序就炸了
16.
// I am not responsible of this code.
// They made me write it, against my will.
我不负责这个代码
他们强迫我写,违背了我的意愿。
17.
/* Please work */
请工作
18.
// no comments for you
// it was hard to write
// so it should be hard to read
没有注释,
很难写,
所以它应该很难阅读
19.
options.BatchSize = 300; //Madness? THIS IS SPARTA!
疯了吧?这是斯巴达!
20.
// If this code works, it was written by Paul DiLascia.
// If not, I don't know who wrote it
如果这个代码能够正常工作,那么是Paul DiLascia写的
否则,我也不知道是谁写的
21.
// Peter wrote this, nobody knows what it does, don't change it!
这是彼得写的,没人知道它是做什么的,别改动!
22.
/** Logger */
private Logger logger = Logger.getLogger();
不管怎么费尽心力,人会受伤的时候就会受伤。by 村上春树
23.
// I have to find a better job
我必须找到更好的工作
24.
// Real programmers don’t comment their code.
// If it was hard to write,
// it should be hard to understand.
真正的程序员不注释他们的代码。
如果很难写
应该是难以理解
25.
// This is black magic
// from
// *Some stackoverlow link
// Don’t play with magic, it can BITE.
这是来自stackoverlow的黑魔法
别玩魔法,它会咬人的
26.
// For the sins I am about to commit, may James Gosling forgive me
对于我即将犯下的罪行,希望詹姆斯·高斯林(James Gosling)能原谅我
27.
// Comment this later
稍后对此注释
28.
// Remove this if you wanna be fired
如果你想被炒鱿鱼,就删除它
29.
}catch(Exception ex){
// Houston, we have a problem
}
Houston,我们有一个问题
30.
// I can’t divide with zero, so I have to divide with something very similar
result = number / 0.00000000000001.
我不能除以0,所以我要除以一个非常相似的数
31.
int getRandomNumber()
{
Return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
通过公平掷骰子选择
保证是随机的
32.
#TODO: Figure out what I’m doing here and comment accordingly.
弄清楚这里做什么并相应地添加注释
33.
// If this code is still being used when it stops working, then
// you have my permission to shoot me. Oh, you won't be able
// to - I'll be dead...
如果这段代码停止工作时还在使用,
杀了我吧,哦~你不能这么做
我死了......
34.
// If you are reading this, that means you have been put in charge of my previous project.
// I am sorry, so sorry for you. Godspeed.
如果你看到了这里,这意味着你已经被任命为我之前的项目的负责人。
对不起,真抱歉。祝你好运。
35.
// I wrote this while drunk, I don’t know what it does,
// but if you remove it the program breaks.
我是在喝醉的时候写的,所以不知道它是干什么用的
但如果你删除它,程序就会中断
36.
// This code worked before, but my cat decided to take a
// trip across my keyboard...
这段代码以前是有效的,但是我的猫决定在我的键盘上跑一趟
37.
long long ago; /* in a galaxy far far away */
在很远很远的银河系外 (这段代码能运行,绝对是个奇迹)
38.
long john; // silver
金银岛
39.
#define TRUE FALSE // Happy debugging suckers
快乐的去调试你的代码吧,哈哈
40.
// Dear future me. Please forgive me.
// I can't even begin to express how sorry I am.
未来亲爱的我,请原谅我
我说不出来我有多抱歉
41.
// private instance variable for storing age
public static int age;
用于存储年龄的私有实例变量
42.
// I am not sure why this works but it fixes the problem.
虽然我不知道为什么这样管用,但它却是修复了问题
43.
last = first; /* Biblical reference */
最后即是开始,圣经引用
44.
try {
} catch (SQLException ex) {
// Basically, without saying too much, you're screwed. Royally and totally.
} catch(Exception ex)
{
//If you thought you were screwed before, boy have I news for you!!!
}
不用多说,基本上你完蛋了
45.
// John! If you'll svn remove this once more,
// I'll shut you, for God's sake!
// That piece of code is not "something strange"!
// That is THE AUTH VALIDATION.
如果你再删除一次
看在上帝的份上,我要关闭你
这段代码不是什么“奇怪的东西”
那就是身份验证
46.
long time; /* know C */
过来很久时间才知道
47.
// Abandon all hope ye who enter beyond this point
入此门者了断希望
48.
/* Ah ah ah! You'll never understand why this one works. */
啊啊啊!你永远都不会明白为什么这个方法有效
49.
catch (Ex as Exception) {
// oh crap, we should do something.
}
糟糕,我们应该做点什么
50.
// TODO make this work
用TODO做这件事
51.
// If you're reading this, then my program is probably a success
如果你现在在认真详细的阅读这段代码,那么写的这段代码应该是没有问题的
52.
// set break point here - you'll never reach it
在这里设置断点-你永远作不到十全十美
53.
/*
** The author disclaims copyright to this source code.
** In place of a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
*/
作者放弃此源代码的版权
这是一份祝福,而不是法律通知
愿你行善不作恶。
愿你宽恕自己,宽恕他人
愿你自由分享,永远不要超过付出
54.
// I'm not sure what I did
我不确定我做了什么
55.
// This is crap code but it's 3 a.m. and I need to get this working.
这是垃圾代码,但现在是凌晨3点,我需要让他能够正常运行
END
2T 程序员大礼包大放送,包括 C/C++、Linux、Python、Java、PHP、人工智能、单片机、树莓派等。
关注公众号????,后台回复「1024」,即可免费获取!
令人笑喷的 56 个代码注释,你写过多少?相关推荐
- 令人笑喷的56个代码注释,你写过多少?
程序员的幽默(ID:humor1024)整理 老衲不请自来, 给大家献上一波神注释 供施主们娱乐娱乐 0. /** Dear Maintainer** Once you are done trying ...
- 这 56 个代码注释让我笑吐了
今日推荐isEmpty 和 isBlank 的用法区别,你都知道吗?SpringBoot项目优化和Jvm调优(楼主亲测,真实有效)国内大神成功给手机装上了 Win11,代码已开源!Fluent Myb ...
- 笑出腹肌!代码注释还是程序员会玩!
点击关注公众号,利用碎片时间学习 来源:转自网络,部分出自 Quora 网友 0.这是一个被代码耽误的诗人 1.来一份 1987 年的代码看看 2.产品经理要对此负责 3.不敢看,也不敢问 4.Nik ...
- 竟还有如此搞笑的代码注释,我笑喷了
某站后端代码被"开源",同时刷遍全网的,还有代码里的那些神注释. 我们这才知道,原来程序员个个都是段子手:这么多年来,我们也走过了他们的无数套路...... 首先,产品经理,是永远 ...
- 竟还有如此沙雕的代码注释!我笑喷了
来自公众号:顶级程序员 某站后端代码被"开源",同时刷遍全网的,还有代码里的那些神注释. 我们这才知道,原来程序员个个都是段子手:这么多年来,我们也走过了他们的无数套路...... ...
- html 搞笑代码注释,那些令人啼笑皆非的代码注释
虾米音乐Mac版客户端中关于VIP会员代码的注释的图片在网上疯传,原因是里面出现了所谓的"穷逼VIP(活动送的那种)". 虾米音乐App前员工八座在知乎更新评论,"对不住 ...
- 10个奇葩的代码注释,笑出声!
大家看到过的最奇葩搞笑的代码注释是什么样的?下面来总结几条: // 修改1 - 2016/6/7 产品经理要求跳转到详情页 // 修改2 - 2016/6/8 产品经理说还是跳转到列表页 // 修改3 ...
- 每一个都能笑抽,39个奇葩代码注释
来源:网络 1. 只有上帝知道 //我写这一行的时候,只有上帝和我知道我在写什么 //现在,只有上帝知道了 2. 相隔时空的diss //somedev1 - 6/7/02 添加对登录屏幕的暂时追踪 ...
- CTO:这代码注释让我笑T了。。。
点击上方[全栈开发者社区]→右上角[...]→[设为星标⭐]点击领取全栈资料:全栈资料 0. /** Dear Maintainer** Once you are done trying to 'op ...
最新文章
- pinpoint zipink skywalking
- 计算机网络工程实验分析与体会_《软件工程》面向对象分析实验
- Shrio 自定义算法登录认证
- 【Linux系统编程】进程间通信--无名管道(pipe)
- Active Directory边界
- live555 源码分析:ServerMediaSession
- C# Aspose.Word 操作word文档(利用模板)
- split函数python 未定义_python split函数基本用法
- 图解排序算法(三)之堆排序
- django-连接数据库mysql
- C#LeetCode刷题之#169-求众数(Majority Element)
- iterator 怎么使用甀_Iterator的使用
- struts2无法调用类静态方法的解决办法
- maven仓库中心mirrors配置多个下载中心(执行最快的镜像)
- Js 模式对话框(转)
- Atitit.java c#.net php项目中的view复用(jsp,aspx,php的复用)
- Flash Cs4 安装之后打不开
- SIP信令中的PRACK的含义和使用
- 华为员工:表面光鲜 工作十年买不起房
- GitHub创建仓库