[CodeSOD] Please Think Twice!

看板C_and_CPP作者 (昏頭昏腦丟臉大了 囧)時間15年前 (2008/09/02 12:04), 編輯推噓4(402)
留言6則, 3人參與, 最新討論串1/1
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

09/02 12:32, , 1F
蠻正常的阿...表示他本人有在進步...
09/02 12:32, 1F

09/02 13:50, , 2F
XDDD 蠻不錯笑的 我也曾拿著自己的程式碼批評
09/02 13:50, 2F

09/02 14:26, , 3F
看不懂 是指脫褲子放屁嗎?
09/02 14:26, 3F

09/02 14:40, , 4F
user`rjacobs` = Rob Jacobs
09/02 14:40, 4F

09/02 15:08, , 5F
那麼這段程式有問題嗎??
09/02 15:08, 5F

09/02 16:17, , 6F
沒有問題 如果兩邊都是unsigned int的型別的話
09/02 16:17, 6F
文章代碼(AID): #18lBjLB0 (C_and_CPP)