作者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
推 kvykn:蠻正常的阿...表示他本人有在進步... 09/02 12:32
推 sunneo:XDDD 蠻不錯笑的 我也曾拿著自己的程式碼批評 09/02 13:50
推 chrisdar:看不懂 是指脫褲子放屁嗎? 09/02 14:26
→ sunneo:user`rjacobs` = Rob Jacobs 09/02 14:40
推 chrisdar:那麼這段程式有問題嗎?? 09/02 15:08
→ sunneo:沒有問題 如果兩邊都是unsigned int的型別的話 09/02 16:17