- 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
nice, very nice
Admin
Heh. I've written an XML "parser" like that. Well, not each character in succession, but just looking for the "magic" value in the middle.
Nice WFT'ery!!!
Admin
beautiful!
Admin
I just died a little inside.
Very inspired work, Keith, VERY inspired.
captcha: craaazy - indeed!
Admin
Hey that's not fair!! I had a proper comment in my post and everything :((
Ok, Ok, Perhaps I shouldn't have replied to the stroppy post, I should have just started a new one.
Anyway,
Nice WTF! Personally I prefer #02 tho, I'm still chuckling about it now. (Would have liked it even more if the cached results were slower to find than the uncached ones tho)
Thanks
Admin
The best I've seen so far
Admin
I really like the idea of a contest to use a overly complicated solution to a simple problem.
I know everybody can badly code, but only a handful of person can do this effectively...
Admin
I also like the XML format he used. Like W3CSchools already so wisely stated, "we should always keep web services generic"...
Admin
Some people have just too much free time.
Admin
Which calculator did you use to help you write this sentence?
Admin
TRWTF is, XML is case-sensitive anyway, so he didn't need all those extra ORs.
Admin
Wow,that's impressive. "16" == "61" and probably "34" and "2221" as well.
Admin
It's close enough to strcmp(), and it works correctly in the place that I use it.
Admin
I was thinking the exact same thing.
Admin
Hugs is much more useful than bc. And what's more 31337 than funx10n41 P0R64|/||/|1N6?
Admin
"16" == "61" == "34" != "2221"
There's a huge DC offset on the ASCII values that kicks in as soon as you've got extra characters.
Admin
This solution is still better than...
...because you will quickly notice the sum compare is failing and will promptly fix it. If you compare hashes, the bug will be so uncommon nobody will ever take the time to debug and fix it and people will just blame it on cosmic rays.
Admin
Another nugget: If either of the strings is empty, you'll either segfault, or read a whole lotta garbage.
Admin
I like how editing the "cache" allows you to define your own math.
For example, I changed test.txt in C:\5.0000-ADD-5.0000 to be 3.14159
Admin
Of course, my personal WTF for the day is commenting on #03 instead of #02.
Admin
This is pretty bad. I didnt submit mine, as I got sick working on it. The idea was to write out two files of lengths x and y, execute "type x+y >z; dir /b z", then extract the file length sum from the directory listing. It worked, for small values of "worked".
Admin
I believe "extracted" was extracted.
Admin
Wow. Thats so awesome. You have made my day!
And I say that as a calculator expert - http://blog.i2pi.com/category/calculator/
:)
Admin
I'm a big fan of the my_malloc() implementation, especially as I've seen it in the wild :-/
Admin
This is definitely my favorite out of the four posted so far, and I think it will be hard for any of the eight to come to top this. The unnecessarily complicated "distributed" design was good, but its frequent re-creation of basic library routines made it even better.
For the XML part, this looks like a great example of someone who completely missed the point of XML and uses it just for the sake of being able to say their program uses XML. The advantage of using XML comes when you need to store or exchange a large data structure, since XML generators and parsers are available for almost any platform you might need. If you write your own parser and generator, it looks mostly stupid, but if might still be worth it if you're storing a lot of information in it or sending it to another program. But when you have exactly one piece of important information in the whole document, then it's 100% WTFery.
I also liked the custom C<string_length> (I know BBCode isn't POD, but i can pretend) function. It seems to work by grabbing 4-byte chunks of the string and shifting them around to check for 0 bytes in the different positions (although I might have something wrong, since it looks like it would only work if C had short-circuit logical and, which I didn't think it did). It's just the kind of code one of those "premature optimization" people would write after hearing that reading memory at the full alignment boundary is much faster than doing it one byte at a time. (processors have had cache memory for how many decades now?)
Admin
Whoa, I haven't seen it in the wild. I based it off something that I found at work that was like this:
Ironically, g_malloc() does not return NULL unless size is 0. If g_malloc() fails, the program exits.
Admin
C does have short-circuited AND; that's how it works.
Admin
Admin
i having a lot of fun today reading this.. although there were a lot of time since I read C++ code...
anyway: I think that this comment (/* case insensitive */) should be taken out, it's makes code clear! (unless it's case insensitive..)
Admin
Admin
My calculator's cache is slower than working stuff out (for addition and subtraction; my multiplication and division are extremely slow). Database access requires constructing the query string (in XML Lisp) using strcat (O(L^2) where L = len(query)), parsing that (my parser does recreate XML's tree structure, but it requires that tags be surrounded by spaces), executing the parse tree (with each variable reference in O(V) for V variables in the environment) and then O(N) to find the item in the cache (it's a linked list).
Of course, this is all done even if the item isn't in the cache: so that's even slower. But in many cases, cache access time dominates.
Admin
I LOVE IT! This will become my main calculator.
Admin
So how does one distinguish between a divide-by-zero error and a legitimate answer to 1867964280 * 2?
Admin
It's stored as a double not an int. A double is 64 bits, and an int is 32 bits. I set the first 32 bits of the double to be 0xdeadbeef, then treat it as a double. The result is random because the second 32 bits are uninitialized.
I run this:
And I get a different result every time.
Admin
Perfectly viable code when used properly, but obviously a WTF when it's copied without understanding. ;D
Admin
bc rules, and you are elite for it. though, you didn't notice the 'ibase' and 'obase' variables inside bc, apparently.. making you slightly less elite.
Admin
You CREATED the NODE then ADDED it to the start... WHY do you need to make a recursive call?
Admin
It looks like the the code isn't 64-bit clean either, it just segfaults whenever you try to push a second button. That problem doesn't crop up when compiled as 32-bit code though.
Admin
Admin
Chris, think this through. As I understand it, the code reads:
If I were writing it, I would write it as:
PS If a function returns a pointer, is it still called the return value?