- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Oh isn't that just precious.
Admin
Evidently not a system to check for duplicated modifiers, Evidently!
Admin
Admin
Dan Brown just cracked the code. Buried inside is Carmen Electra's phone number.
Admin
I thought this too, and I didn't even play Homeworld that much!
Admin
"My eyes! The googles do nothing!"
http://en.wikipedia.org/wiki/Radioactive_Man_%28The_Simpsons_episode%29
Admin
Kinda ASCII art :-)
Admin
I was going to say that it is a Duff's Device, except bigger and better, but:
Isn't this in effect the same as
etc.?
Admin
A load of Jackson Pollocks maybe
Admin
THANK You! I really HATE it when people get it wrong like that!
Admin
TRWTF is C++ as target language. Why they need to rewrite application to worser language than original?
Admin
c++ version: http://pastebin.com/f39ca0e55
Admin
The time has come for an obfuscated VB contest... It's too easy to "[http://www.ioccc.org/years.html]do it in C[/url]"
Admin
This is more like a "Duff Beer Device".
Admin
The coder was OBVIOUSLY an artist trying to create an ASCII right-parenthesis )
Admin
Looks like automatically translated code that someone ran through an automatic formatter.
Admin
Admin
Prehapes this is what can happen if you follow TDD to the extreme...
Keep writing if statements till all tests cases pass.
Admin
The only true bug I can find is that after the line "kom = kom+1" there should be a line reading
If m(16)=0 Then GoTo n16
so that "Next i16" is skipped if "For i16 ..." is skipped.
If m(1)=0, then i1 is never initialised; presumably the full code initialises i1, ..., i16 (and kom) to something sensible.
I think the code is supposed to do this:
Select all permutations of 16 numbers where the nth number is between 1 and m(n) (unless m(n)=0, in which case the nth number is equal to some default value), subject to the constraint that none of the numbers chosen be equal (unless m(n)=0, in which case the default value is chosen whether or not it is equal to one of i1, ..., i[n-1]; but none of i[n+1], ..., i16 can be equal to the default value (unless they also take their default value)).
The format used suggests that m(n) should be between 0 and 99 inclusive.
Admin
I remember this code from the old days, now you would simply use the getDate() method!
Admin
Admin
The real WTF are these guy's actually trying out where things are incorrect in the code! How much time are you wasting with that! You are fired!
Admin
Admin
Admin
Admin
OK, so curiosity got the better of me and I looked again in the comments for a better solution. Nada. Apparently no-one else could read it. So here it is:
I kept it in VB6 just because, but it would have been easier in something else.
Having seen the result, it looks like it's a lottery number generator. 16 two-digit numbers with no duplicates and only in ascending order.
Admin
Ok, I don't think anyone LIKES c++, but worse than VB??? Really? You Really think so?
Admin
awww how cute! you get all offended when someone pokes fun at the only stuff you know!
your insecurity is showing.
Admin
Admin
Admin
I'm assuming that the in's start out zero or undefined. (Anything else would be too horrible).
Then all of the long disjunctions can be replaced by comparing once against "the i of the innermost enclosing loop where m(.) is nonzero". And then the entire thing can be made infinitely more readable by using recursion instead of nesting.
Admin
"looks like". Can you think of any other reason to keep the numbers in ascending order (other than "by accident", of course)?
But, since we don't know the initial values of the m array, it's entirely possible it has a completely unrelated purpose. We also don't know where that data ends up. That's another thing, was that function even being used at all, or was it just a relic of something used only once?
Admin
Admin
Admin
I can sympathize: if you can't figure out what the hell it's doing, or why, but you know you need it, what else do you do? (And you don't always have the time necessary to puzzle it out).
All you can do it move the code over, and put big WARNING comments around it.
Admin
And yes, it's deliberately bad code inspired by previous WTFs, thanks for noticing.
Admin
TRWTF is commenters flaming on C++. Just because you can't understands some of it's more complex aspects is no reason to depict it as being worse than VB, which one of the most abused languages in existance.
Another WTF is that they choose to refactor the app to C++ while a higher abstracted and more maintainable language like java and (shudder) .NET and possibly python and ruby are much more suited to business logic.
Using C or C++ is pretty much overkill for anything that doesn't require high performance. On the other hand, C is great for drivers and C++ is great for simulations, games and other high performance computing.
Admin
Oh, definitely. C++ may not be the worst programming language ever created, but without a doubt it's the worst ever to be taken seriously.
Admin
Valgol kinda reminds me of LOLCODE (another esoteric language)
e.g http://en.wikipedia.org/wiki/LOLCODE
Admin
There are only two kinds of languages: the ones people complain about and the ones nobody uses. Bjarne Stroustrup
Admin
Which is sadder: that you spent time and effort making a Star Trek: The Motion Picture reference, or that I understood it?
Admin
I was thinking about an english teacher, myself.
Admin
This is the first time I've commented on this site. I had to. This code made me say "WTF" out loud. It's a good thing no one heard me.
This is truly awful. I thought getting 30 tons of coal delivered was hilarious, but this is better. Anyone who can code like this should be able to do it simpler.
How does code like this get past a peer review?
Admin
Admin
Ugh. How predictable... people get bored and stoop to pointless language bashing.
Anyway: 1) Surely he didn't paste the VB code into his C++ code, but rather translated it from one to the other (perhaps without understanding it).
Admin
#define! Let's implement VB6 in the C++ preprocessor!
Admin
Dijkstra was understating - looking at that, "harmful" doesn't begin to describe it.
I would like to tell myself you made that name up, but it does sound like an actual MS product.
Admin
This comment is the winner. I would like to add one internet to your score. I am laughing out loud.
Admin
Admin
I poked out my eyes out, jut so could be sure not to see that code more