- 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
Which would be what the 'volatile' keyword is for.
Admin
Wow. See, this is why computer science needs a professional "engineering" association, which includes ethics in the prerequisites. It exists in other fields, why not in computer programming?
Admin
Err, maybe I'm missing something--but given the 16-bit overflow, wouldn't the "speed-up loop" be infinite? Or is that the real WTF?
Admin
Ben, read each character on the 'for' loop line very carefully... the trailing semi-colon is the catch.
Failing that... curly brace matching on the reflected code FTW!!
Admin
A lot of optimising compilers probably have specific code for recognising a completely empty loop and not removing it on the grounds that it's a common (albeit broken) idiom for a delay, and people would grumble if their software stopped working.
Admin
Admin
This may be a very naive point of view, but I agree with your sentiment... intentionally crippling a solution for the purposes of future reward is a bit too morally corrupt for my tastes... transparency and honesty are my watchwords as a contractor, and it has never steered me wrong
Admin
Maybe i isn't an int.
Admin
You are truly evil... I couldn't resist the urge to paste this into Word to see if you were serious... curse ye!
Admin
Sorry, I just picked some random thing that could happen if you wrote to arbitrary areas of memory in a system without memory protection. You're right, of course. Writing to a video buffer won't crash the system. It might, however, make it difficult to see the results of overflowing the integer though.
Genius programmer: "Damn it! Every time I run this program the video goes blank and I can't read the error message. Oh! I know, I'll just log the error it to a file!
picks random sector of disk and writes debugging information before and after the loop
My point is that the OBVIOUS error in that code sample was picking a seemingly arbitrary point in memory to write zeros. The integer overflow was actually rather subtle.
Admin
His first day and he's already giving tours?!
Admin
Yeah, I was a bit hasty on that one. At least I wasn't the only one though :)
Admin
Re: the 80/20 rule... that reminds me of the worst project I've ever worked on. The whole thing was designed in two weeks by the management, and then they gave the design to we programmers. I should have run for the hills right then...
So anyway, when we said that there was no way we could build the system in their time-frame (about six months), they invoked the 80/20 rule. They said, 80% of our users will only need 20% of the functionality, so build that first. When we pointed out that the system would be a total disaster unless we accounted for the other, complicated, 20% of users from the start, they said "don't worry about that, just build the code for the easy users first, then add on the extra stuff later".
The project was a total disaster. Version 1.0 was released, but the users were told not to use it. The managers got their bonuses - ker-ching. The whole thing was scrapped a few months later.
Admin
It tells you that it's 1024 words on the front page
Admin
I think only 80% of people define it that way...or was it 20%?
Admin
I hope you are kidding! Check out the article date on http://portal.acm.org/citation.cfm?id=365000.
I agree substantial advances have occurred in optimizations since 1989, but it was hardly "new".
Admin
Admin
I always looked at the 80/20 rule as Scotty's Law...
Scotty: How long did you tell the captain the deflector work would take us? LaForge: Two hours and we have barely more than that till the Borg cube arrives. Scotty: And how long will it actually take us? LaForge: Two hours-like I told him. Scotty: Geordi, ye've got a lot to learn. You never tell captains how long it will really take. How do you expect to earn a reputation as a miracle worker that way?
Admin
Since nobody has actually posted the correct definition of the 80/20 rule yet--
So for example, in any given programming shop, 80% of the usable work might be generated by only 20% of the programmers.The example that "Wayne" gives appears to be a mangling of Westheimer's Rule:
Admin
Aha... I came in via a direct link in the RSS feed, so I didn't see that... its only 892 according to Word (904 if you include the title and by-line gubbins)
Obviously this is an indication that Microsoft is short-changing me on words... bastards... :P
Admin
Blaming IE is always a good idea.
But seriously the word-count is located right of the "Full Article" link on the FRONTpage (not the article page)
Admin
The traditional 80/20 rule is: 80% of the coding is done in 20% of the time, and the last 20% is done in 80% of the time (or more).
Admin
Honestly, thats brilliant!
Admin
On a 16-bit machine the loop should run 16960 times.
Admin
Ok, if there's an int overflow, how would the loop even compile or how many times it would run if it compiled?
for(i=0;i<1000000;i++) {;}
So the fix would be to use nested speed-up loops?
Could you post the codes because I need too many iterations to speed up my programs.
Admin
Admin
Admin
The compiler is quite right to optimise the loop test away in this case. If you don't want it too you have to declare someThreadVariable volatile. A common misconception about C is that it's just a slightly advanced assembler, whereas the compiler is actually allowed to rearrange the code to it's hearts content. So long as it still appears to do what the code says, and all accesses to volatile variables and extern functions occur in the precise places they do in the code.
Admin
What pains me is that so very very few folk know how Byzantine some work situations really are. I mean, you have to have been there at least once in your life ... straight out of Kafka's "The Kastle." This is a great story.
I've been pimping it as an alt interpretation of 80/20, but here's my alt: you get 80% of the buzz by doing 20% of the heavy lifting; or putting it otherwise, with 20% of the effort you can cobble something together that provides 80% service to 80% of the users in 80% of situation. So where's the incentive to actually finish anything?
My sympathy to anybody with actual needs and requirements, I mean more than the need for plausible deniability. Most software I'm seeing seems designed as entertainment ... "constant partial attention" and "social objects", the stuff of mass delusion.
--bentrem
p.s.1 "The corruption of the best is the worst." p.s.2 "Incompetence is the thin edge of a wedge called corruption."
Admin
Don't forget about the sign bit so you only get half the range.
Admin
An int is 32 bits on a 32bit machine. The 386 came out in 1985, it's very likely that in 1990 they were using 386s and not 286s... therefore it's not an overflow caused by a 16bit int.
Admin
One coworker suggested the following way to estimate projects (I'm not sure if he was serious or not!)
Take your best guess, multiply by 2, add 1, and move to the next higher unit of measurement.
So, if you think it's two hours, estimate 5 days.
Admin
Apple Macintosh, X-Windows, & SmallTalk all had mature GUI systems by 1989 (or 1987 as some comments mark the story). Microsoft Windows is, by far, the latest entry to the GUI world.*
People bought Microsoft Windows because, like MS-DOS, it was cheaply bundled with PCs. VHS beat out Betamax on a similar price issue. Sometimes shit floats to the top.
Admin
Let's assume it did. I fyou made the variable volatile, it would guarantee that it has to be compiled.
Admin
Not sure how much much impact this would have on the processing time though. I guess a modern compiler would kind of optimize this it away?
-{II}-
Admin
Yes, but it's like any other rule-of-thumb: useful to know, but if that kind of thing is all you know, then you're just bullshitting.
Admin
Isn't Initech the name of the company in the movie Office Space?
Admin
So it's kind of unfortunate that the pointer 0x10000 wouldn't fit in a 16-bit pointer address (which DOS compilers also have to suffer under) either... 0x1:0 maybe, if it's compiled Huge.
Admin
IAWTC.
Admin
Actually, in terms of usability, this is a fairly common technique and there is some psychology behind it. When performing an AJAX operation that saves data, for example, users tends to disbelieve that it could have possibly saved in such a short amount of time. The calls tend to be almost instant. Thus, they'll click several times just "to make sure."
Users are (and I'm generalizing hardcore here) still conditioned to believe that the form they just spent a full minute filling out needs at least a few seconds to save. They want to see something happening. So, a half second pause to display a "Saving.." animation always does the trick. It soothes the users preconceived notion about how this stuff should work and actually looks nice by giving the visual queue. So, I wouldn't quite call that a WTF.
Besides, as per Wayne, when your happy (but conditioned) client gets annoyed that it takes too long to save, you can boast major speed improvements with ease!
Admin
And I thought the 80/20 rule was that 80% of users only use 20% of the features, but a different 20%
Admin
I thought the bug was that it writes into unallocated memory.
Admin
Nobody says it was unused.
Nobody says it was an int, either. The fix would obviously to use long.
An int is what the compiler defines it to be. The only guarantee is that int can represent numbers from -32767 to +32767.
Admin
int i; char *p = 0x10000; for (i = 0; i < 1000000;i++) { *p++ = 0; }
uhmm, maybe i'm missing something, or back in the 80's the program could just set zeroes to a megabyte of memory it didn't allocate?
Admin
Admin
MS-DOS has absolutely no memory protection, and memory allocation is just a courtesy.
Admin
Only if you're using C++ or a recent version of the C standard. The original guarantee is that:
sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)
with additional guarantees of
sizeof(void *) == sizeof(int) sizeof(unsigned x) == sizeof(signed x)
and that a char is large enough to store a single text character in the platform's preferred text encoding. On a machine using 7-bit ASCII, you could theoretically have an int with a range of -64 to 63.
Admin
The 80/20 rule is a hypothesis (or idiom, not sure what to call it) that 20% of your software bug will take up 80% of your time. Or something like that.
Admin
Reminds me of the days of IBM mainframe programming with CICS back in the '70s. The CICS programmers would introduce a throttle in new applications to increase response time to a few seconds on each transaction. As the CICS region became more overloaded during the subsequent months with the increase in traffic and additional applications, the response time would degrade. So they would just reduce the throttle to maintain the expected response time.
This would go on until the system was saturated and no more reductions were available. Then they would upgrade the hardware and start all over again.
Admin