Tendo City

Full Version: The Daily WTF
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
http://thedailywtf.com/

Behold unto some coder's lack of knowledge of existing features, and also just plain terrible code.

[code]
Function IsEven(N)
Dim LastDigit
LastDigit = int(N) mod 10
IsEven = (LastDigit = 0) or (LastDigit = 2) or _
(LastDigit = 4) or (LastDigit = 6) or (LastDigit = 8)
End Function

Function IsOdd(N)
Dim LastDigit
LastDigit = int(N) mod 10
IsOdd = (LastDigit = 1) or (LastDigit = 3) or _
(LastDigit = 5) or (LastDigit = 7) or (LastDigit = 9)
End Function
[/code]

[code]
enum Bool
{
True,
False,
FileNotFound
};
[/code]

I think this is one of my new favorite web sites.
Horribly inaficent, he must work for Microsoft :)
The humor of that is completely lost upon me.
I'll try to break it down. The first example shows two functions being created. They are for determining even numbers and odd numbers. Without going into further detail, the first thing you should be aware of is that compilers (programs that write other programs) as a general rule already have such functions built in, and are more efficiently done at that which can be called with a simple statement. Declaring these functions is pointless, reinventing the wheel, only it's an oval.

(There are other major issues, for example whether or not the function adequatly handles integers of various sizes and how it corrects for incorrect data types and so on and so forth which the built in function can generally be expected to already be optimized to deal with.)
So it wasn't supposed to be funny, then, and is rather just an example of incompetent coding?

Because, you explained it (and I needed it, coding is hardly my forte), and I understood your explanation, and even still, it just isn't funny.

I don't mean to be a mugwump, I'm just saying that etoven is the new alien space marine, without the excuse of being French-Canadian.
Except that etoven actually has talent.

As for it's comedic value, I suppose it loses something in the translation :D. Let's just say it is roughly like installing a convoluted power switch ala those crazy contraptions that sharpen a pencil on a computer that already has a perfectly functional power switch.

This site has massive examples of that, and for a lot of people who have knowledge of coding, it can be pretty funny. I think LL should enjoy it anyway.
Ryan Wrote:I'm just saying that etoven is the new alien space marine, without the excuse of being French-Canadian.

Hor.. ray..?
yuh huf bug nuples
No, Uh huv bug nupples!