作者Killercat (昏头昏脑丢脸大了 囧)
看板C_and_CPP
标题[CodeSOD] Please Think Twice!
时间Tue Sep 2 12:04:36 2008
http://thedailywtf.com/Articles/Please-Think-Twice.aspx
"While reviewing some of our older code," Rob Jacobs wrote, "I stumbled upon
this."
"某天,我在翻阅一些旧CODE的时候",
Rob Jacabs说,"我发现了这些东西"
// NOTE: Please think twice before changing the next line of code ;-D
// Store float binary in char array
*((unsigned int*)(&x[4])) = *((unsigned int*)(&value));
"I showed this to my coworkers," Rob continued, "and we all agreed: while
functional, this sort of thing will land you in your own circle in hell. I'd
be remiss not to scold the original coder for such bad practices, so I peeked
in SVN to see who was responsible."
"我把这段CODE SHOW给我同事看",Rob记叙说,"我们都同意:即使这段码能作用,这
也绝对会让人误入歧途。我一定是忘了去好好念一下一下写这段CODE的人,叫他好好
改一改。"所以,我去看了一下SVN的记录,看这段CODE到底是谁搞出来的
$ svn log
r3 |
rjacobs | Thu, 18 Jul 2002 18:03:46 -0500 | 10 lines
r2 |
rjacobs | Mon, 15 Jul 2002 17:47:57 -0500 | 1 line
r1 |
rjacobs | Mon, 15 Jul 2002 17:40:08 -0500 | 34 lines
"Whoops"
"哎呀我的妈"
--
XD
这篇我觉得是近期比较好笑的一篇 XD
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.120.35.85
1F:推 kvykn:蛮正常的阿...表示他本人有在进步... 09/02 12:32
2F:推 sunneo:XDDD 蛮不错笑的 我也曾拿着自己的程式码批评 09/02 13:50
3F:推 chrisdar:看不懂 是指脱裤子放屁吗? 09/02 14:26
4F:→ sunneo:user`rjacobs` = Rob Jacobs 09/02 14:40
5F:推 chrisdar:那麽这段程式有问题吗?? 09/02 15:08
6F:→ sunneo:没有问题 如果两边都是unsigned int的型别的话 09/02 16:17