• Sebastiaan (unregistered)

captcha: slashbot. What brought me here a long time ago. (Almost)

• (cs)

What's the problem? Fixed-point math has a long and honorable history.

And there are only a few ways to divide-- shifting the divisor up or down until it can be subtracted is perfectly good. Your fancy Crays might use some fancier algorithms, but for a calculator limited by mouse speed- this routine is fast enough. But don't ask me if it's foolproof. Or works correctly for all inputs.

• (cs)

"a real, live, rotting codebase"

Something you can smell from a long way off. Nice entry!

• (cs)

Nice entry, but...did I miss something? (It is Monday after all...)

Wasn't the point of the contest to write new code that mimicked WTF code? Not just to submit buggy code that was over 10 years in the making?

And no, I didn't submit a calculator, so this isn't just sour grapes.

• Hit (unregistered) in reply to Galelasa
Galelasa:
Nice entry, but...did I miss something? (It is Monday after all...)

Wasn't the point of the contest to write new code that mimicked WTF code? Not just to submit buggy code that was over 10 years in the making?

And no, I didn't submit a calculator, so this isn't just sour grapes.

This is NOT real code. It's all made up. The author just brilliantly made it look that way.

• Snuggles (unregistered) in reply to Hit

I used to sit next to Steve-O.

I can vouch for you right now... that's not the only piece of WTF-code his company has. I submitted a few entries myself!

You should have seen their VB nightmare.

Whenever I see/hear the words "bContinue" I start to get a sick feeling in my stomach.

• T\$ (unregistered)

I think my favorite part is in CalcFunc.cpp:

else { /* Divisor is greater than dividend; shift divisor right until

• divisor is less than or equal to dividend
• we will fix this at the start of the upcoming while() loop */ }

whew good thing we're going to fix it later, for a second I didn't think there was anything that could handle this case, haha. Keep 'em coming!

• (cs) in reply to Hit
Hit:
Galelasa:
Nice entry, but...did I miss something? (It is Monday after all...)

Wasn't the point of the contest to write new code that mimicked WTF code? Not just to submit buggy code that was over 10 years in the making?

And no, I didn't submit a calculator, so this isn't just sour grapes.

This is NOT real code. It's all made up. The author just brilliantly made it look that way.

I'm going to go address my obvious caffeine deficiency now...

o_O

• Larry Lard (unregistered)

The real WTF is that the text "ièce de résistance" is inexplicably in Arial (and with a <font> tag, too!)

• PS (unregistered)

The real WTF is that the bugs were fixed on Saturday / Sunday.

• (cs) in reply to PS
PS:
The real WTF is that the bugs were fixed on Saturday / Sunday.

you have too much time uin your hands!.. I didn't noticed either

• (cs)

The Real WTF is the contest forums are gone.

Well, they were gone a minute ago

• (cs) in reply to PS
PS:
The real WTF is that the bugs were fixed on Saturday / Sunday.

If you knew anything about my company, you'd know that was no WTF.

• KeyJ (unregistered)

A "RISC processor that can't divide" is actually much more common than you might think: All ARM Processor Cores up to ARM9 belong to this category -- and these devices power almost every PDA and Smartphone out there, amongst uncountable other embedded systems. Even iPods use them (clocked at a mere 75 MHz) and do all the MP3/AAC decoding on them. Bottom line: Division is overrated :)

• guest (unregistered)

I’ll leave you with Stephen’s answer to a question I asked all finalists: would you replace calc.exe on Windows with your calculator?

It's sad that I'm now sure that I'm not a finalist :(

• Ash (unregistered) in reply to Hit
`````` Galelasa:
Nice entry, but...did I miss something? (It is Monday after all...)

Wasn't the point of the contest to write new code that mimicked WTF code? Not just to submit buggy code that was over 10 years in the making?

And no, I didn't submit a calculator, so this isn't just sour grapes.
``````

This is NOT real code. It's all made up. The author just brilliantly made it look that way.

I think you meant "The author just brillantly made it look that way."

• guest (unregistered)

This is NOT real code. It's all made up. The author just brilliantly made it look that way.

No, he brilliantly made it look as if he brilliantly made it look that way.

• (cs) in reply to Oliver Klozoff
Oliver Klozoff
Nice
• o_0 (unregistered) in reply to Ash
Ash:
>This is NOT real code. It's all made up. The author just brilliantly made it look that way. I think you meant "The author just brillantly made it look that way."
There is no requirement that a WTF must have a typo....
• (cs) in reply to Ash
Ash:
Posting your captcha: -100 Following a pirate reference with "argh": -1000000 (it's "Arrr", all you argh-posting dumbasses)
• GordonB (unregistered)

There's one not even mentioned - I just compiled and ran the code and there's no way of getting a decimal point into the number entry box other than to divide two numbers together.

• Name (unregistered) in reply to guest
guest:
I’ll leave you with Stephen’s answer to a question I asked all finalists: would you replace calc.exe on Windows with your calculator?

It's sad that I'm now sure that I'm not a finalist :(

Same here. Hopefully, the non-finalist entries will get some sort of writeup on the front page instead of just a giant linkdump.

• Salisbury Steak (unregistered) in reply to guest

I second that, I thought my wtfery was tops!

• (cs) in reply to Name
Name:
guest:
I’ll leave you with Stephen’s answer to a question I asked all finalists: would you replace calc.exe on Windows with your calculator?

It's sad that I'm now sure that I'm not a finalist :(

Same here. Hopefully, the non-finalist entries will get some sort of writeup on the front page instead of just a giant linkdump.

Don't worry, I have several front-page articles planned for next week that discuss the non-finalists. There were so many incredible submissions. It was very hard to choose!

• Rick (unregistered)

This is clearly not a WFT. This code has comments!

• Rick (unregistered)

Well, this code is also not a WTF. Too bad I can't spell.

• Jimmy (unregistered) in reply to Rick
Rick:
This is clearly not a WFT. This code has comments!

What Findeth Thou?

• (cs) in reply to Zylon
Zylon:
Ash:
Following a pirate reference with "argh": -1000000 (it's "Arrr", all you argh-posting dumbasses)

He might have been hoping for ninjas, in which case "argh" is correct.

• BlueKnot (unregistered)

I liked this one before I even looked at the code... just the screenshot made me flash back to "intro to (any language)" courses: the left-aligned number box, the blocky key layout w/ lots of wasted space, and the curios absence of a 'minus' key (there is a plus/minus key that looks like negation...?)

A+ for realism...

• (cs)

OK, found some bugs... Well... Two, in facts.

1. there's a buffer overrun when you type too much numbers (more than 15) in the calc UI... Well... it's WTF code :)
2. another bug that I fail to explain : when the number begins to get big (> 10E35), the malloc(20) in "int IsNegative(float)" returns a null pointer.
• sammy (unregistered)

From King of Prussia, PA? Hey! Hi from Paoli!

Captcha: stinky. Just like the code. Ah.

• dkf (unregistered) in reply to Rick
Rick:
Well, this code is also not a WTF. Too bad I can't spell.
Hah! Did you bother to look at the code? It's got more than enough strangeness even if you're unreasonably biased against comments...
• dkf (unregistered) in reply to o_0
Comment held for moderation.
• Joost (unregistered)

Oooh that code just makes me itchy all over. Well done.

• another coder (unregistered) in reply to KeyJ
KeyJ:
A "RISC processor that can't divide" is actually much more common than you might think: All ARM Processor Cores up to ARM9 belong to this category -- and these devices power almost every PDA and Smartphone out there, amongst uncountable other embedded systems. Even iPods use them (clocked at a mere 75 MHz) and do all the MP3/AAC decoding on them. Bottom line: Division is overrated :)

Of course I'm sure you're aware that if you write your AAC and MP3 decoders correctly you don't need a divide (the block codes can be recovered with a multiply, or even better rigged huffman decode tables)

Anyhow, lucky bugger actually gets routines to do divide :( I suppose that he gets log, exp & pow too!

• (cs) in reply to another coder

Big deal. Everyone knows division is simply reciprocal multiplication.

• alt.jokes.pentium (unregistered)

Skeptical of floating point operations on the then-new Pentium processors

Ooooops. What's a genuine serious non-WTF doing in a place like this? The Pentium belonged here but the skepticism was necessary.

This almost reminds me of one of my WTFs. I had successfully written microcode to implement a SQRT machine instruction using available registers, but my implementation of a DIV instruction spilled one value to the user's addressable stack. A friend kindly asked why I didn't shift new bits into reusable space in a register that I had just shifted other bits out of. Then she said my blush was really impressive. (This doesn't qualify as a genuine reminder of a WTF because I was an undergraduate, and the university wasn't even WFTU. Oh well.)

• John (unregistered)
He develops for tiny devices called “Nodes” that have a whopping 512K of memory, a 2x20 display, and a RISC processor that can’t divide. Really: their compiler treats “%” and “/” as syntactical sugar that gets replaced with a call to a library function which, in turn, uses a series of bitshifts and subtractions to perform division.

You soft pampered desktop developers. You really have no idea.

Not that long ago, I was programming devices with 64 bytes of RAM (it's not as bad as it sounds - they had 1K of ROM for the code). No divide? No multiply either. And no XOR. And a six entry stack.

• Edss (unregistered) in reply to o_0
o_0:
Ash:
>This is NOT real code. It's all made up. The author just brilliantly made it look that way. I think you meant "The author just brillantly made it look that way."
There is no requirement that a WTF must have a typo....

There is if it aims to compete with the likes of Ho-Speed Printers...

• Simmo (unregistered) in reply to John
John:
He develops for tiny devices called “Nodes” that have a whopping 512K of memory, a 2x20 display, and a RISC processor that can’t divide. Really: their compiler treats “%” and “/” as syntactical sugar that gets replaced with a call to a library function which, in turn, uses a series of bitshifts and subtractions to perform division.

You soft pampered desktop developers. You really have no idea.

Not that long ago, I was programming devices with 64 bytes of RAM (it's not as bad as it sounds - they had 1K of ROM for the code). No divide? No multiply either. And no XOR. And a six entry stack.

Sounds like bliss to me.

• John (unregistered) in reply to Simmo
Simmo:
Sounds like bliss to me.

It was. Simple straightforward programming to solve simple straightforward problems.

• (cs) in reply to Snuggles
Snuggles:
... that's not the only piece of WTF-code his company has. I submitted a few entries myself!

You mean you /wrote/ the WTFs yourself! Don't worry, we've ripped all your code out by now.

• Seegras (unregistered)

There was no "original Doom for DOS", the original was actually programmed on NeXTSTEP and then ported to DOS (and to everything else, from Linux to Irix to Solaris).

• 855 (unregistered)
Comment held for moderation.
• (cs) in reply to Carnildo
Carnildo:

He might have been hoping for ninjas, in which case "argh" is correct.

I thought ninjas would be more like "Hai yaah!"

• alex, why (unregistered)