Showing posts with label Classic WTF. Show all posts
Showing posts with label Classic WTF. Show all posts

Wednesday, February 03, 2010

else....where??

http://thedailywtf.com/Articles/Else-where.aspx

「我手下曾經有一個非常強的專家,他留下一句名言:給我足夠的NAND Gate(譯註 : 這是一種邏輯閘,相當於先取and再取not...剩下的請查閱這裡),我將統治全世界」,Rob B,在他的一本書裡面寫到:「其實換個繞口令一點的說法,你用上一整片的NAND Gates,你可以做出其他邏輯閘能作到的任何事情。當然啦,因為有其他邏輯閘能作這些事情,你實在不該浪費一狗票NAND gates來作這種無聊的事情。恩...這樣的確是辦得到的...寫code的時候偶爾也會有類似的思維」

「前陣子我們從我們的外包商那裡看到了一份實在是爛到爆炸的C++ code。這東西平均每行出錯率實在是真他媽的高,而且他的寫碼風格讓我們越看越想咒他老母。不過,這種What the fuck的感覺,到我們看到這組code的時候達到了最高點。」


while(true)
{
if(mainType == 7)
{
subType = 4;
break;
}

if(mainType == 9)
{
subType = 6;
break;
}

if(mainType == 11)
{
subType = 9;
break;
}

break;
}


「來來來我們看看這堆鳥東西....」Rob繼續寫到:「我花了些時間在想,他幹麼寫這樣?這個while loop到底是幹麼的?只是拿來搭配break跳過下面那些if的嗎?我還真沒看過那麼蠢的,完全不是拿來作條件判斷的break...好啦,這是我第一次看到。」

Bob補充:「我幾乎可以確定這傢伙完全不知道什麼叫做else if....他好像只知道if while break,所以就把他們拼在一起了...用這種超白爛的方法做出這個邏輯。」

Tuesday, February 02, 2010

Classic WTF : What the hell enum!?

One day, while I was roaming through Internet, I bump into a article while I was viewing a frequently viewed forum =3

in HeaderDefine.h(This is a header file that will be included in almost every files)


/*----Be sure you have READ this!----
...
...(a long term of manual of this header)
...

I have made this way to make sure
everyone will read this manual.
By Genius Jason
----------------------------------------------/*
enum DECLARE
{
I_HAVE_READ_THE_MANUAL_AND_KNOW_WHAT_I_AM_DOING_THIS = 38106,
I_HAVE_READ_ABOVE_AND_AGGREED_THE_TERM_OF_USE = 39100
};


You might be confused what the hell it is for, ya, it's a trick. While using some function or callback, you have to follow his way or a assert will be invoked :

KaimCore.Init(I_HAVE_READ_ABOVE_AND_.....
KamiCore.CleanupDump(I_HAVE_READ_THE_MANUAL_AND...



"Fuck you Jason you damn moron!"