- 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
Admin
Admin
I think my brain just turned itself inside out. Can anyone else see a possible justification for this? The only valid use I know of for arrays of func ptrs is a (fixed sized) list of callbacks.
Admin
Everytime someone writes terrible code like this, a little kitty dies...
The code says it perfectly -> };
I would cry too.
Admin
Hey, how come they don't do featured comments anymore?
Admin
+2! Make that a Featured Comment please..
Admin
Because nobody writes anything funny anymore. That, or it's a big conspiracy.
Admin
Also a wonderful way to control a "catsplosion" in Dwarf Fortress
Admin
Why???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Please do not reply with "WHY NOT".
Admin
Interesting...
Admin
What the hell are you guys talking about? TDWTF used to be funny, turned trolling, turned to whatever the hell this is...
I can't really complain though because I'm still here reading and commenting.
Admin
Admin
Now I understand Toyota's sudden acceleration problem.
Admin
No, Askimet, a link back to the host site is not spam.
Admin
Admin
LOL, really? That's funny... No, sorry, you're not clever enough to emulate, though I'm sure you keep that featured comment badge close to your heart. I honestly just didn't realize.
Admin
Obviously the new programmer just isn't as clever as the old programmer.
Whether clever programmers should be allowed to live... well that's a whole separate discussion.
Admin
Well it is an ogre of a problem.
Admin
I think it all started back in August which, ironically, featured a troll. If we were to play hangman, I would hope you could fill in the blanks:
_ _ r t
_ _ _ _ _ t r _ _
(by the way, if you can't figure out who I'm referring to, you should go away and grow up ;)
[to be continued, based on Askimet censorship]
Admin
Day after day, BG (as we'll call him), would comment using the same exact form as stated in the original article, not doubt getting the same amount of glee and fulfillment as the guy originally mentioned in the story. After a while, the moderators with no explanation started deleting posts. One would rationally conclude they decided "enough is enough."
As normally is the case, this did not stop the problem. The enraged troll kept it up, and the volume of posts, along with misspelled versions indicated that other trolls were joining his cause against "oppression" and "censorship". Posts kept vanishing, and the troll found more and more clever ways to fly below the moderators' radar. Soon posts with a simple reference to "wooden tables" or "embedded systems" would vanish, driving more trolls to his cause.
The mods haven't studied history. The best way to eliminate trolls is to ignore them, plain and simple. Just like violence in Afghanistan, you're just going to recruit more soldiers by deleting posts. Just like an improperly-applied anti-biotic, you are going to make the trolls more clever if you sometimes delete posts and sometimes don't.
While I enjoyed the ride, I do not like how those with intelligence now use it for evil instead of valid comments. Be wise, gentlemen.
Admin
Interestingly, this is pretty much how you write Python modules in C (that is, bindings to C code for Python). Except I think the array is even larger there.
Admin
Add another factor: the addition of Askimet, which is extremely badly broken.
Admin
Admin
Why ask why?
Admin
Admin
The constant trolling by a few "cool" kids turn even the most well-meaning participators in trolls.
Admin
Admin
The downside is you have to require registration and logon to read posts.
Admin
Admin
Admin
Unless they have backup "lurker" account.
Admin
Admin
I suppose I could probably detect the more clever/less annoying trolls if I put more thought into it, but if they don't annoy me, then I don't care.
Admin
Admin
Who doesn't have one of these?
Admin
Admin
TRWTF here is that someone who would write this:
"Apparently, this structure is essential for passing information to other layers. Now if I only knew how it's supposed to do that..."
Was allowed to work on the project at all, and not sent to do some vb6 or javascript or something. Someone really should have said, "step away from the c compiler slowly, and nobody will get hurt". It shouldn't have to be said, but evidently I guess it has to be. A requirement for working on ancient c embedded systems is the ability to read c. This isn't even particularly complex c at that, it's just a normal vtable implementation. This is part of the piece of code that handles input from a hardware device. That device almost certainly is sending a packet of data where the first byte is an opcode, then two bytes indicating the length of data, then the data, and then probably a checksum. The code reading the data in from the port sanitizes it and calls the correct handler.
This isn't difficult stuff, and the only very, very small potential WTF here is using NULL instead of a dummy function that just returns, but I can think of several reasons off of the top of my head for not doing that. The input could be sanitized elsewhere, this could be essentially a 'subclass' vtable, many other possiblities.
Admin
Admin
Admin
Sigh. There are 255 of them. 10 per line. Can you count to 10? What would you have them do? something like, in code, assign:
SID[OP_START_DIAGNOSTIC] = &start_diagnostic_session;
etc.? That's a really bad idea, because it's wasted space on a system where you're very likely counting bytes to fit all the code and data on a very small ROM, and it's simply unneeded. If this kind of thing bothers you, stay the heck away from embedded systems.
Admin
You posted twice, and have yet to tell people to stay the hell off your lawn... I'm quite disappointed, I must say.
Admin
Shudder That line of code reminds me of an application I used to maintain. The codebase had several thousand lines of code like that in many different constructors. This particular application also had a C++ header file that had over 40,000 line of code. That file had the full inline implmentation code for something like 250 subclasses. Just thinking about that monstrocity makes me want a drink...
Admin
I do this same thing in C#. After all, the simplicity of using lambda expressions is made even more simple by passing them around in giant STRUCTS. I dump every lambda I need into a struct and just pass it around everywhere.
Admin
Kind of like a reverse matryoshka doll from an evil parallel universe.
Yes I did write that code in the Starbucks built on top of an ancient Native American burial ground ... why do you ask?
Admin
So TRWTF is... actually, nope, the WTF IS TRWTF.
Admin
Admin
I died a little inside reading that.
Admin
I died laughing!
Admin
You just know someone is going to read that, and think that it's 'extensible', or that it's some kind of pattern...
Oh intertubes, you know not what power you yield over the minds of the uneducated, unwashed masses.
Admin