作者AmosYang (LetMeGoogleThatForYou)
看板Soft_Job
标题Re: [闲聊] 大家工作上看过哪些夸张的 CODE ?
时间Sun May 16 23:53:18 2010
code 与 comment 就像是 Jedi 与 Sith 的关系
有兴趣的人可以看看 stackoverflow 上的这个讨论串
http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered
(短网址:
http://tinyurl.com/4qs8x3)
摘录几个我个人觉得颇好笑的 comment:
(原本想试着补上中文翻译的,不过翻译非我强项,总觉得翻译得怪怪的
且有些笑点在翻译的过程中就蒸发了
所以…有兴趣的人自己看吧)
==================================================
stop(); // Hammertime!
==================================================
//When I wrote this, only God and I understood what I was doing
//Now, God only knows
==================================================
// Magic. Do not touch.
==================================================
// drunk, fix later
==================================================
/* This is O(scary), but seems quick enough in practice. */
==================================================
This seems to stop morons from messing my code...
"Autogenerated, do not edit. All changes will be undone."
==================================================
#define TRUE FALSE //Happy debugging suckers
==================================================
long long ago; /* in a galaxy far far away */
==================================================
// I don't know why I need this, but it stops the people being upside-down
x = -x;
==================================================
double penetration; // ouch
==================================================
//Dear future me. Please forgive me.
//I can't even begin to express how sorry I am.
==================================================
// I am not responsible of this code.
// They made me write it, against my will.
==================================================
// somedev1 - 6/7/02 Adding temporary tracking of Login screen
// somedev2 - 5/22/07 Temporary my ass
==================================================
options.BatchSize = 300; //Madness? THIS IS SPARTA!
==================================================
#Christmas tree initializer
toConnect = []
toRead = [ ]
toWrite = [ ]
primes = [ ]
responses = {}
remaining = {}
==================================================
On initialization of a linked list:
last = first; /* Biblical reference */
==================================================
I worked with a guy who was raised a Muslim, but had a rather
tongue-in-cheek view of the religion. He left this comment
above a particularly nasty chunk of code:
// I will give you two of my seventy-two virgins if you can fix this.
==================================================
// no comments for you
// it was hard to write
// so it should be hard to read
==================================================
// This comment is self explanatory.
--
"Mr. Data, can you show me how to parse this XML?"
"Certainly, sir.
Let me google that for you."
-- StarTrek, the Next Gen. 《Back to 2009》 (误)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 65.87.177.87
1F:推 motocyman:看到圣诞树笑了… 05/17 00:00
2F:推 megaman1206:推圣诞树XD 05/17 00:10
3F:推 james732: 推圣诞树XDDD 我怎麽都没想过要这样写 05/17 00:22
4F:→ andymai:笑是蛮好笑的~但实际上功能都写不完了~哪有闲情逸致搞这些 05/17 00:37
5F:推 tjhuang:大概是圣诞节的晚上,看着万家灯火同时赶code的心酸吧 05/17 00:46
6F:推 loopuntil:很好笑又有点辛酸XD 05/17 01:13
7F:推 dryman:XDDDDDDDDDDD 05/17 07:56
8F:推 tcw026:lol..XD 05/17 08:04
9F:→ tcw026:我喜欢这一个: return 1; # returns 1 05/17 08:59
10F:→ tcw026:推文1: 经典! 但是这一个更好 "i++; // increase i by 1" 05/17 09:00
11F:→ tcw026:推文2: 谁知道他有没有定义#DEFINE 1 成其他的东西.. 05/17 09:02
12F:→ tcw026:推文3:他是用什麽语言? 05/17 09:03
13F:→ tcw026:所以return 1; //加注解 returns 1或许真的有需要XD 05/17 09:05
14F:推 dryman:我最喜欢magic, do not touch 05/17 12:12
15F:推 hilorrk:Now, God only knows....XD 05/17 12:27
16F:推 lwecloud:long long ago, in a galaxy far far away <=这很靠杯XD 05/17 21:04
17F:推 yauhh:我也要学着在工作中导入幽默感 05/18 02:52
18F:推 ledia:我想一切还是以实力的累积优先会比较好 05/19 13:20
19F:推 ctrlbreak:我以前都排火箭 05/19 21:07
20F:推 ikari512:XDDDD 05/19 21:55
21F:→ AmosYang: ↖ XD 05/20 00:14
22F:推 CarlOrz:推 斯巴达 "300; //Madness? THIS IS SPARTA!" !!! 05/22 00:25
23F:推 flylover:XDDDDD 斯巴达跟圣诞树XDD 10/31 02:21