- 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
Bad software, written by people with better things to do with their time than read manuals...
Yup. Sounds like a situation where a ruptured blackwater line hit a ventilation device.
Admin
Hmm. I'm certain - even back then - an optimizing compiler should have done something about caching that value rather than recalculating it every loop. Unless, of course, the real code modified
text
in the loop....Admin
Or maybe optimization was turned off, because everything broke when it was enabled?
Admin
Since everything broke anyway, according to the story, I don't think it really mattered....
Admin
Picture this scenario: "The program's not working! I bet it's the compiler's optimizations again. Optimization is so broken. Well, I'll disable it and the program will start working." i.e. Tool Blame
Admin
With a PC VS 8051, that's likely to be the case with a regular program, even back in those days.
Fast forward to 6 months when the stressed hardware began to fail due to static discharge, and the perfected software was again suspect.
Admin
Causing a massive green explosion.
Admin
not exactly
Admin
Oh :(. I wondered why Tyrion wasn't mentioned.
TRWTF is the Red Keep's IT department.
Admin
yeah, i was making a extremely elaborate
fit hits the shan
analogy.didn't know that GoT would have ruined it by having a place named after sewage...
Admin
"Vice President and a Marketing Drone"
"the VP and MD"
Oh dear, sigh. Two nations divided by a common language and all that.
In British, "MD" normally stands for "Managing Director", which lent a certain air of surrealism to the whole proceedings. (So they sacked a dev for incompetence and rehired him as Managing Director? That would explain a great deal.)
Admin
It's the only way for subscribers to the It's Just Typing philosophy to learn a lesson.
Of course, those people are probably very good at wilfully not learning lessons.
Maybe it was a subtle jab at the poor skill-level of the MD. I could be wrong.
Admin
In the U.S., this is the first time I've ever seen it not stand for "Medical Doctor." Sounds like it could have used one.
Admin
Yup - I used to have a boss (who knew nothing about s/w dev or computers for that matter) who would always end a verbal request for a new feature with "how hard can it be?"
One of the worst jobs I ever had - it as my first s/w dev job.
Admin
Admin
I always say that sarcastically, when things are going to be really complex and/or difficult. If you are giving someone a hard task, you may as well do it with some levity. :smile:
Admin
That's why, after being fired as a Marketing Drone, he was hired back again as a surgeon. The other MDs were spending too much time in the OR so the company needed someone who could design operations that would just work right the first time.
After all, what could possibly go wrong?
Admin
I prefer the ones who buttume they know how complex something is. Of course, they buttume wrong, so the "ultra hard" request boils down to changing a CSS class, followed by a "20 minute task" of redesigning half the database because half the spec just changed...
Admin
Those dreaded words in a triage meeting when the stakeholder says "this should be a really simple change..."
Admin
I love when business people try to prematurely optimize the solution before the tech folks have even looked at it. "Why didn't you ask for X? You seem like you actually want X." "X sounded complicated, we'd be fine with only Y" where Y is twice as hard as X.
Admin
@snoofle: "its", not "it's"
Admin
C support for something like the 8051 would have been cutting-edge back then, and probably only vaguely resembles what you know as C. Microcontroller C compilers did (and still do) have lots of proprietary extensions to handle weird addressing schemes and other hardware limitations. I've never used an 8051 specifically, but Wikipedia says it used a Harvard architecture, which means completely separate address spaces for code and data. Usually this means that the pointer 0x1234 means something completely different depending on which address space you're in. Given what a hack-job it already is I wouldn't count on any μC optimizer for anything.
Replacing EPROMs was pretty much the only way to upgrade firmware back in the day. The customer should be thankful the device actually had a socketed chip rather than one that was soldered in place.
Doubles may not be the best for financial data (and I'll bet that these were actually single-precision floats given the hardware) but you can't just blithely assume that because all numeric values are whole numbers that you won't need fractions somewhere along the line. Try buying 1 item priced at 2 for $5 and you'll see what I mean. At the very least if you're switching from floating point to integer you might need to change your units (from dollars to cents, or even tenths of cents).
Static discharge can do real damage, and they should have been using static straps in any case. I've blown some very expensive equipment due to lack of a strap.
Admin
I don't know which of those falls down, but even GCC today (well, a couple years ago anyway) doesn't do this.
Then we disassemble:
(And before you ask, no,
-O3
doesn't help. Tested with GCC 4.7.3.)Edit: MSVC 2010 makes the optimization with
/O2
. GCC 4.9 does not with-O2
. clang 3.5 does not with-O2
. Even icc (ICC) 14.0.3 20140422 does not make that optimization with-O2
or-O3
.Admin
Not if he knows what's good for him.
Admin
I have. There's no other way to use an 8051. Odd little beast.
The idea of trying to make it do anything meaningful in anything other than 8051 assembler strikes me as wildly optimistic.
Admin
Yeah, the 8051 was designed for direct assembler-banging, not any of the niceties of C, which is part of the reason it's so deeply weird as a C (or any other high level language) target, compared to even, say, the AVR or MSP430, which are supported (as cross targets, ofc) by GCC.
Yeah, no doubt; I had a $200 video card go south on me during a memory upgrade for that reason! I would use fixed-point here as well; unless you are in the land of 754r floating decimal support -- which still isn't all that portable -- a decently wide fixed-point type works as well as anything for representing money. (The system I worked on as an intern uses a 64-bit fixed point representation for all currency values, and it works quite nicely -- it's a back-office system for payment card transactions, btw.) Quite: with ARM Cortex-Ms being available for sub-$1 in onesies any longer, there's no reason to *ever* design in an 8051-derivative in this day and age.Admin
And you know that, regardless of how bad the VP and MD screwed up, and despite the fact that this guy saved their business, those two got bonuses several orders of magnitude higher than he did.
Admin
They're visionaries!
Admin
A simple change? I've heard that so many times! To the person uttering the words, it is a "simple change" because they don't have to do it. To the person doing the work it is an entirely different situation. There can be things that one might assume to be "hard" that are actually quite easy (see speed up loops), and things that look easy "land a man on the moon" that are actually quite difficult (you wanted him to be alive and return? You didn't say that!). Oh, well, better luck next time!
Admin
"1MhZ 8051 processor" I'm thinking, what is this, the 80's? "But this was still in the '80s..." ok, never mind. :-/
"Customers != Tech People" I LOL'd at this, +1
"sent via com port" When read as "sent via CORN port," you know that either:
Admin
Rule one of software architect-ing: never trust the customer when it comes to requirements. (Or much else either, but I digress…) If they knew exactly what they were doing, they wouldn't be asking you to do it for them.
Admin
1Maybe somebody somewhere designed a variant with hardware FP, but I've never used nor heard of one, and we use 8051s in some of our products.
Admin
Not always entirely true. Sometimes you can sell chips in which some feature doesn't work as cheaper versions without that feature while you work on fixing it.
However, if you discover a problem with chips that you've already sold, it's just a little harder and more expensive to fix than releasing a software update. (Anyone remember FDIV?) Even if you don't have to recall chips from millions of consumers, just tooling up to make the new, improved chips may cost $2M or more. If you're really lucky, you can fix what's wrong by using the logic gates that are already there and connecting them differently, in which case you might be able to get away with spending only $200k - 400k. Just for the tooling; not counting engineering time to diagnose the problem, come up with the fix, and implement it, nor the loss from scrapping the defective chips.
This is why hardware guys put so much effort into getting it right before committing a chip design to silicon. The effort to make sure it works is roughly double the effort to design it.
Admin
Ah, these decadent days of compilers that (sometimes) fix the programmer's lame code.
Back in those dark days of microprocessors with 64K memory pages, well, what you wrote...was what you got.
If you wrote bad code, it worked...badly! Your incompetence was directly translated to lost market share, instead of just showing up in a TDWTF article. There were no flashy GUI's to hide behind.
Hmmmmm...actually, I guess it could be bad then and make TDWTF, now, couldn't it?
Admin
8051 coders can only dream of 64K memory pages.
Admin
Admin
It might be able to do it in your old compiler if you declare that
text
is aconst char *
. I think newer compilers (not much newer!) can detect that the argument is effectively constant and pull thestrlen
out. (Clang 4.2 seems to be able to do the optimisation.)I prefer to pull that sort of thing out explicitly. I don't like a compiler making too many assumptions about what is safe; some things are only safe if you can prove something non-trivial first (such as “no concurrent thread will modify this memory” which requires knowledge about much more than the compilation unit).
Admin
I currently have to make a datepicker for a field on a form. Which isn't an unreasonable request, but it's clear that they don't actually mind not having a datepicker, the current text field is fine except that it doesn't validate that the date isn't in the past. The customer is clearly under the impression that the text field doesn't 'allow' this validation and a datepicker would. But because a datepicker is a reasonable request, I can't go back to them and say 'you don't need a datepicker to validate it's not in the past'.
Would have been little more than a copy-paste job from the last time I had to implement date validation on a text field in a similar form. Instead I have to implement the validation AND make a datepicker.
Admin
Can't you use some off-the-shelf date picker? There must be a squillion different ones out there for just about any GUI implementation strategy you might be using…