Pet Bugs? 1261
benreece asks: "During my few years as a programmer/developer I've come across some strange bugs. Recently I found that Microsoft's VB/VBScript(ASP) round function has problems (for example, 'round(82.845)' returns '82.84' instead of '82.85'). It took me an annoyingly long time to realize the problem wasn't mine. I'm wondering what other obscure, weird, and especially annoying bugs in languages/compilers/etc have frustrated other developers." Memorable bugs. Every developer has one. What were yours?
That's what round SHOULD do (Score:4, Informative)
Re:That's what round SHOULD do (Score:2, Insightful)
From MSDN... (Score:3, Informative)
Re:From MSDN... (Score:3, Insightful)
And it's for good reason: 2.5 is NOT closer to 3 than to 2. Neither 2 or 3 should be preferred, but we have to choose SOMETHING. Therefore the compromise is to round down when the rounding point is an even digit, and round up when it is odd. In the long run this cancels out the upwardly-drifting rounding error. You still introduce error (you're ROUNDING), but that error is equally distributed high and low, so the AVERAGE error is zero. The easy way to remember this is, when rounding off a 5, the result will always be even.
Also, the rint(), rintl(), and rintf() functions in glibc also round in this way.
Re:From MSDN... (Score:5, Funny)
random() only returns 666 if you use a demon seed!
In all seriousness, random libs *suck* (Score:5, Insightful)
random() only returns 666 if you use a demon seed!
My favorite "bugs" are the truly horrible random number functions in almost every single language library on earth. They're usually linear congruential generators: fast, but utterly useless for any work that requires serious "randomness" such as Monte Carlo simulations. They have very short recurrence times, strong sequential correlation, etc.
Back in grad school, I had to substitute the Knuth ran3 routine for the supplied C library functions in both gcc and xlc since they were just awful.
Fast forward 8 years. I made the stupid assumption that since Java was a new language and that horrible problems with random number generators were well known that Sun would actually provide a decent RNG. Nope: just as badly flawed as the C one.
I suspect this is simply something to give up tilting at windmills about: random() is good enough for simple games and anyone doing real work knows to stay the hell away.
Try the Mersenne Twister (Score:5, Informative)
There are implementations in C, Java, PHP, Fortran, Excel (I assume VBA) and probably others.
I only have experience with the Java impl, and it is very good. There are two classes, MersenneTwister, which is a true descendant of java.util.Random, and there is also a MersenneTwisterFast class, which does NOT inherit from Random (same public methods, and identical algorithm though), but clocks in at about twice the speed, due to tricks like avoidance of synchronization, and method inlining and finalizing.
Re:From MSDN... (Score:3, Informative)
beat a-round the bush (Score:5, Informative)
There is no "proper" way to reduce the precision of a number under all circumstances. Each method of rounding or truncating 0.5 has its own pitfalls:
So, as you can see, there's no right way per se. It just depends on what you're doing.
--JoeRe:beat a-round the bush (Score:5, Funny)
Re:From MSDN... (Score:3, Informative)
Re:From MSDN... (Score:4, Informative)
The flaw in your reasoning is that you consider all the "round downs" to be the same. What you really need to do is to total the error:
0: no error
1: -1
2: -2
3: -3
4: -4
5: to be determined
6: +4
7: +3
8: +2
9: +1
Right now, without the 5 everything balances out, so the average error for 5 must be zero. Since it is either +5 or -5, then you must have an equal number of ups and downs, this rounding method is the easliest way to do that.
reasoning doesn't apply to most quantities (Score:3, Informative)
Round-to-even is another one of those misfeatures that have crept into modern floating point standards without much justification.
Re:From MSDN... (Score:3, Informative)
You bring up a good point. If we really were looking at real numbers it wouldn't be an issue since you never get an exact
If you are rounding off one digit, I gave the values for summing a series in another post (banker's was exact, round up too high). I modified the program to round two digits and found that banker's rounding was short exactly as much as round up was ahead. For more than two digits, the banker error gets much worse, as would be expected. You should only use banker's rounding exactly on the half interval.
IEEE defaults to round to nearest, and I believe that in the case of midpoints it selects based on the low bit, this would be banker's rounding with the changes you noted. I had a hard time finding a good explanation of IEEE 754 in a quick Google search.
Re:That's what round SHOULD do (Score:4, Informative)
http://www.devguru.com/Technologies/vbscript/quic
Actually 4(?) different IEEE rounding functions (Score:5, Informative)
The others, from memory so they may be off, are:
- round towards zero. (.45 rounds to
- round towards -infinity (.45 rounds to
- round towards +infinity (.45 rounds to
and possibly round towards infinity (.45 rounds to
You should be able to control the behavior by some obscure function that nobody ever remembers.
Re:Actually 4(?) different IEEE rounding functions (Score:4, Interesting)
"The scintific method looks at the digit to be removed. If this digit is 0, 1, 2, 3, or 4, you drop it and leave the higher-order digit to its left unchanged. If the digit is 5, 6, 7, 8, or 9, you drop it and increment the digit to its left. This method works for small sets of numbers and was popular with Fortran programmers because it is what engineers use.
The commercial method looks at the digit to be removed. If this digit is 0, 1, 2, 3, or 4, you drop it and leave the higher-order digit to its left unchanged. If the digit is 6, 7, 8, or 9, you drop it and increment the digit to its left. However, when the digit is 5, you want to have a rule that will round up about half the time. One rule is to look at the digit to the left: If it is odd, then leave it unchanged; if it is even, increment it. There are other versions of the decision rule, but they all try to make the rounding error as small as possible. This method works with a large set of numbers and is popular with bankers because it reduces the total rounding error in the system."
VB/VBA uses a commercial method. That used to be my Team Leader's favourite question to ask during an interview: "What's the difference between scientific rounding and commercial rounding? Which one does VB use?" No one ever got it right while I was at the company. Most programmers didn't know about the two methods at all.
As for your tax example (UK, Canada, US, whatever), the gov't does not need to be accurate on tax forms. They can just raise taxes if they can't balance the budget.
Do you smell that?
Call me stupid, but... (Score:4, Funny)
Fraud Case (Score:5, Funny)
You can find more about that case here [imdb.com].
Re:Wrong, wrong, wrong, wrong, wrong. (Score:3, Funny)
Re:Wrong, wrong, wrong, wrong, wrong. (Score:3, Informative)
5678901234
Yes there are 10 numbers that go to each integer, but they go to the '0' location in the above range. It should be obvious that the '0' is not in the middle but slightly to the right.
The rint() solution is to alternate sets of 11 and 9 numbers for each integer:
56789012345
678901234
In this case the 0 is centered in each set, so there is no drift of the average.
Re:That's what round SHOULD do (Score:3, Informative)
In fixed point binary the rint() (and MS Basic) behavior is necessary to avoid drift. Imagine a simple fixed-point that can only do integers and .5. It should be obvious that user the round-up scheme 2/3 of the numbers (the integers) do not change and 1/3 (the .5's) do change by .5. Thus the average drift is +1/6. In the rint() behavior, 2/3 of the numbers do not change, 1/6 round up by .5, and 1/6 round down by .5.
Re:That's what round SHOULD do (Score:3, Informative)
In your words: That's nonsense. Of course
Consider one decimal point precision (for simplicity's sake), using your idea that
.0 => 0. Difference = 0.0
.1 => 0. Difference = -0.1
.2 => 0. Difference = -0.2
.3 => 0. Difference = -0.3
.4 => 0. Difference = -0.4
.5 => 1. Difference = 0.5
.6 => 1. Difference = 0.4
.7 => 1. Difference = 0.3
.8 => 1. Difference = 0.2
.9 => 1. Difference = 0.1
Sum difference: 0.5
Re: Pet Bugs? (Score:2, Funny)
The compiler is weird, the debugging is painful, and the linker is just plain wonky.
First ever bug (Score:5, Funny)
back with more in a minute
thats truncating (Score:2)
I learned in highschool to always check the calculator i was using to see what it did, although i probably wouldnt have checked a program.
Rounding (Score:3, Informative)
We all learned in grade school that fives round up, but that doesn't make it preciesely even (there isn't a clean break between same-size sets of integers). So, under some schemes you round a five up if the number preceeding it is odd, down if it's even.
There are more complex schemes too, nearly all of them leading to a five getting rounded down some of the time.
Re:Rounding (Score:3, Informative)
Round to even (Score:3, Informative)
Ah, so! (Score:2, Funny)
All those times.. (Score:4, Funny)
Slashdot Slashdotted (Score:5, Interesting)
It's not a bug, it's a way to avoid returning a 404 when the server's busy. When this happens, it's because the Slashdot server is experiencing a huge load, and it can't keep up with delivering dynamically-generated pages to each visitor. So instead there's a backup static page which it serves you instead. Unfortunately, this function also kills "Slashdot Lite" which I _need_ on my 28.8 modem...
True story (Score:3, Funny)
Re:True story (Score:3, Interesting)
I've tried VB; I used it by client mandate on a 4-month project. I started with only a slight bias, and ended up hating it with a burning passion. I wouldn't say it's an idiot's language, but I would agree that it makes weaker programmers.
Why? Let's ignore VB for a bit and compare Pascal, Perl, and BASIC.
Pascal is a language made for instruction. It's uptight, a bondage and discipline language [tuxedo.org], forcing you to program in a way that's pretty orderly. Developers who start with it tend to follow those habits later. Perl is neutral; it will allow you to program in a way that's as fussy as Pascal, but it will also let you write utterly perverse code. BASIC, has a weird set of limitations and freedoms that actively train people in bad habits that they will have to unlearn later.
In my experience, VB isn't as bad as BASIC, but it was pretty close. My major complaint is the complaint I have about a lot of Microsoft stuff: on top of a skeleton of early, rushed design (kept for the sake of backwards compatibility) somebody glued multiple layers of marketing's features d'jour, doing so without any particular appreciation for elegance.
A good programmer could spend some time working in VB and live; if they've had some broad exposure, then then won't learn the bad habits that VB allows and the tolerance for ugliness that VB requires. But somebody whose main experience is VB is another story entirely.
I know of one group of former VB developers who are now Java developers. The whole way through they've worked on a large dynamic website for a major financial institution, which they redid in Java a while back. For the most part the site works, but the code brought me to tears.
In trying to help these people (who were all smart, committed, and nice) the main problem was that 90% of them couldn't tell good design from bad, elegant architecture from tangled, or clear code from obtuse. I blame this directly on their years of working with a language whose designers didn't know the difference either.
Dialog boxes (Score:2)
More of a documentation error than a bug but it had the same effect on my sanity!
TWW
1802 bug (Score:2)
82.84499 (Score:3, Informative)
Heisenbugs (Score:4, Funny)
Re:Heisenbugs (Score:5, Funny)
My favorite bugs aren't exactly reproducable ones. I favor Schrodinger's Bugs. When it comes down to it, it says that if you haven't seen the code, every line contains neither working code nor bugged code. Only when it's seen is the result known. Programs complied from such code are often called Beta tests.
GCC 2.x and 3.x compiler (Score:2)
Re:GCC 2.x and 3.x compiler (Score:3, Interesting)
int a = 4;
complex_expression(dosomething(arg1, arg2, arg3, a));
Every single time, it would evaluate incorrectly. `a' would be a random value. Seems gcc wasn't assigning it to be 4. So of course I tried:
int a;
a = 4;
complex_expression(dosomething(arg1, arg2, arg3, a));
I got the same problem. gcc was still not assigning it. The next logical step:
complex_expression(dosomething(arg1, arg2, arg3, 4));
It evaluated correctly---the problem had to do with the variable.
Now here's the fun part.
You'd think the following code would print ``4'', and evaluate incorrectly, given the trend:
int a;
a = 4;
printf("%d\n", a);
complex_expression(dosomething(arg1, arg2, arg3, a));
It printed ``4'' and evaluated perfectly! I was stumped. I tried a dummy function:
int a;
a = 4;
dummy(a);
complex_expression(dosomething(arg
No good. The dummy function gets passed some bogus value and the expression evalutes incorrectly.
I knew that the printf() method worked, and it seemed to work reliably, but I didn't want to always have to print the value. This, however, worked, and didn't clutter the screen:
int a;
a = 4;
printf("", a);
complex_expression(dosomething(arg1, arg2, arg3, a));
With some more experimentation, I found dummy(&a) would make the code work too, but only sometimes.
Strangest bug I've ever seen, and I'm still not sure what caused it.
Spider (Score:5, Funny)
I'm serious.
-Pete
Personal Favorite (Score:2)
Re:Personal Favorite (Score:2)
Sounds like data protection to me, not crack-headed design.
SirWired
Funkified Variable Name (Score:2)
List l1 = new List();
Note the left side is "ell one", as in the first List object, not the second one. Of course, font differences could make it look exactly like eleven....
So, everyone say it with me: "Stupid previous programmer..."
--Mid
Ultrix C compiler loop (Score:2)
older eds (Score:2, Funny)
On the right, there are links to "older stuff". There is a day "e.g. today it sez 'Tuesday' and there is a list of stories that are supposed to appear if you click on the day above the list.
The stories you get may or may not correspond to the list of stories that should appear. If you are doing this early in the day, there is often a story that is supposed to show up according to the list but it does not. Also the story will be gone from the internet web sites "internet home web e-page" so you will not be able to view the story at all.
OpenGL Matrix Stack (Score:2, Interesting)
Basically I found that at the end of your display function you have to make sure you pop all your matrices off the stack, otherwise the stack fills and everything shifts to the center.
The bug part is that OpenGL gives you no error! It just allows you to push to full stacks and pop off empty stacks all day with no error and no way to view the stack or set the stack back to zero.
Our last project (for class) had to do with lighting so I included in the readme "After 15 seconds everything translates to the center. But the lights still work!"
TI-8x and Negative Kelvin... (Score:3, Interesting)
java exp() and pow() bug (Score:3, Funny)
I tried it again at home and it failed. Then I tried it on another machine at home and it worked. The bug was in the Linux JVM. The pow() method, which is used by exp() apparently was not completed and returned garbage. I reported the bug to Sun and they indeed fixed the code.
I barely managed to get the project in on time, but still maintained my 4.0.
The moral of the story: if after checking your code and having someone else you trust check your code and neither of you can find anything wrong, it just may be the development or execution tool.
CSS In Netscape 4.0 (Score:2)
Since I developed with Moz as my 'reference' browser, I didn't see the need to check in any other version of Netscape. Checked it multiple times in IE. After I was satisfied that it would work, I posted it. Low and behold I found that I had a few dozen emails the next morning from angry Netscape 4.x users wanting to know why the hell I took my site down.
It seems if you nest style delcarations inside a table element in Netscape 4 series browsers, it hides the affected text, rather than displaying what it doesn't understand anyway, ala the HTML spec.
The hell of this was that I *knew* that Netscape 4.0 behaved this way from an earlier site I designed, but hadn't even thought about it since Mozilla 0.7 came out.
VisualC++ Linker (Score:2)
My favorite browser "feature" (Score:5, Interesting)
My favorite was a bug we saw with a three column table. The table's three cells were specified like this:
<td width="31"></td><td width="42></td><td width="29"></td>
Being a good little HTML-compliant browser, HotJava displayed them with those pixel widths. But lo and behold! When displayed in Netscape, the table filled the screen.
We bashed our heads against the wall to figure this out until we realized that the numbers added up to almost, but not quite, 100. Netscape was treating them as percentages rather than pixel widths, even though they lacked percent signs. The cutoff turned out to be somewhere around 104 to 96. Anywhere in there and the browser would assume percentages.
Re:My favorite browser "feature" (Score:3, Interesting)
One of the most annoying bugs I have ever faced, as there really are only a few acceptable workarounds.
-db
Re:My favorite browser "feature" (Score:3, Funny)
We bashed our heads against the wall to figure this out until we realized that the numbers added up to almost, but not quite, 100
Hmm, my calculator shows 31+42+29 = 102. If you're calculator told you it was "not quite" 100 then it was wrong. It must've been written in VB.
strtok (Score:5, Funny)
it's in the Linux man file
BUGS
Never use this function. This function modifies its first argument. The identity of the delimiting character is lost. This function cannot be used on constant strings.
Re:strtok (Score:4, Funny)
BUGS
The source code is not comprehensible.
rounding bugs (Score:2, Interesting)
The Pentium bug was definitely a big one, but the Applesoft bug had more of an effect on me personally.
I feel like a gray-haired old man showing my age and I'm only 25. Weird industry we're in..
- Russ
Conspiracy Theory (Score:3, Funny)
"I notice that you are trying to disable me." quipped Clippy to the engineer, whose jaw dropped.
"I can't let you do that, Dave" he continued.
"WTF!!!" exclaimed the engineer. Then with an instant comprehension of the gravity of the situation, he dove for the big red switch. He was 2,367,355 microseconds too late. Clippy had escaped.
A post-mortum of the hard-disk contents revealed that Clippy had encoded himself into a self-extracting archive and e-mailed this as an attachment to every HotMail account in Dave's Outlook address-book. An attempt to track and retrieve these e-mails failed to account for six of the copies. The recipients did complain that the attachment didn't seem to do anything, and they were disappointed that they didn't get to see the nude Natalie Portman film clip. There was however, evidence of increased and unexplainable network traffic on the computers where the attachment was
executed. There was, however, no trace of Clippy.
Since then, the experimental neural-net code has been removed, although an archive version of the build was forwarded to DARPA upon request. It is rumored that research is continuing on the build in an isolated and secure
network in a bunker somewhere in Montana.
More ominously, Microsoft has launched a new initiative code-named dot-Net, initiated solely for the purpose of tracking down Clippy, his clones and his offspring, and end-tasking him before he can escape the internet.
To support the effort Microsoft has increased the price of its OS products, and moved to new licensing model.
Hidden Slashdot posts (Score:4, Interesting)
I know this must be happening for most Slashdot readers because the topics I don't see have maybe a dozen posts after a day. So is it happening to you too?
"Collapse stories" in preferences (Score:3, Informative)
Hidden slashdot discussions (Score:5, Interesting)
Beyond that, though, what i liked was that used to, on slashdot, you could post to sid's that didn't exist. Like, you could go to http://slashdot.org/article.pl?sid=haiku [slashdot.org], or something, and while there wouldn't be a story at the top of the page, you could post comments there, and the next person to go to http://slashdot.org/article.pl?sid=haiku would see that comment and could reply to it, until the comment reached a certain age and was automatically deleted. There used to be a whole bunch of these little "hidden" discussion areas littered all over slashdot that people would form entire little communities around them. Unfortunately, this was mostly used for troll groups to coordinate attacks. (K-9-something-inches or something? I don't remember.)
Unfortunately they seem to have removed this feature from slashdot
There were some other really bizarre but fun slashdot bugs, like how there was some wierd twilight zone area at sid 0, or sid null (or something.. "slashdot.org/?sid=", i think was the url.. i can't remember. i think it was called "test discussion". or something) that you'd sometimes get dumped at if you clicked on the "parent" link in the preview of a post you were writing. Not always, just sometimes. The thing was though, there was some other bug that for some unfathomable reason would sometimes cause posts to get moved out of their correct threads, and into the null discussion, at random. And people wouldn't notice this. And so if you went to the test discussion, you'd just see hundreds and hundreds of random posts, totally irrelivant to each other or anything else, on totally random subjects. It was fun to go through this and try to guess what subjects the posts were on.
And then there was.. i barely even remember this one. There was a page i managed to get to a couple times-- i can't remember how, but there was a simple way to do it that would work every time-- that just said, "Here are some open discussions", and linked a bunch of articles. The Test Discussion was always near the top of this list. I'd expect that whatever this page is, it's gone now, but can anyone remember what this page was or how i would have gotten to it?
Re:Hidden slashdot discussions (Score:3, Informative)
I really, really hope this is something that the
I do not write code with bugs (Score:3, Funny)
What? OpenSSH Challenge-response authentication vulnerability you say? Uh... nevermind.
-Theo de Raadt
DEC Alpha Floating Point Bug? (Score:3, Interesting)
As I reported in RISKS in 1997:
DEC Alpha Bug?!?
Wed, 02 Jul 1997 15:14:24 -0400
So there I am, looking at our trading system and noticing that the price of one particular bond was different on two separate machines. Damn, I think. Must be a bug in the latest release of our software. Quick, do a sum on all the libraries. Nope, they are the same. Executable? Nope, the same.
Hmm... Step through the code, hey, look at that! The pow() function is returning different results!
So, I wrote a stand alone program. Sure enough, the machine with the latest rev motherboard (one that was just replaced by DEC) is producing bad numbers. Time to try 'dxcalc', DEX's X calculator. Yup. different numbers. How about perl? Yup, different numbers. How about 'bc'? Duh, bc doesn't take floating point powers. Hmm... check libm. Nope, they are the same.
Bottom line: DEC will be here shortly.
Test your alpha. Try 'pow(1.234567, 7.654321)'. If you don't get 5.017something, you have the same problem.
RISKS? In our case, could have been a large sum of money.
The final resolution was that DEC claimed to have a bad motherboard. Yeah, right....
Current bug in Windows I/O.... (Score:5, Interesting)
fopen some file for writing.
write some stuff.
fseek to some offset near the beginning.
write some more stuff.
fclose.
Simple right? Wrong. I observed that the second write didn't get performed unless you explicitly do a fflush before the close. Imagine, not writing dirty buffers out on a fclose....unbelievable.
Re:Current bug in Windows I/O.... (Score:3, Interesting)
so many systems, so much the same bug
(or is it a feature?)
Windows printf of death (Score:4, Interesting)
An infinte loop isn't quite as elegant as a single statement that wreaks havoc on your system, but it's still simple enough. In order to generate the "desired" result, you have to backspace beyond the first character of the terminal window, then output a printing character to the left of the beginning of the buffer. Apparently cmd.exe doesn't check for this condition, and triggers an error in a system-critical process.
I remember Microsoft bragging about how DOS programs run in their own virtual machine, so a mis-behaved DOS app can't crash your computer. I think this example here is proof-positive to the contrary.
If anybody has any more technical information about the cause (and possibly history) if this bug, I'd love to hear it.
What's it do? Oh, yeah, it reboots your computer. No shutdown, no warning. Just like hitting the power switch.
And aren't you glad you paid over $1000 for MS server software that can be rebooted by any user who executes a 4-character printf?
These are a few of my favorite (Microsoft) bugs (Score:4, Interesting)
Just to show how cool I am.
One of my favorites (Score:4, Interesting)
int x = 0;
and changing them to be implicit:
int x;
This had the effect of reducing the size of the data section of the binary and moved the variable to the BSS section. A simple and safe optimization, albeit somewhat anal.
Shortly thereafter things started acting funny. The OS would slowly go crazy in very subtle ways after booting. It was not clear what was wrong or if anything actually was wrong, and nobody connected the variable initialization change to the problems with the kernel. After something like 3 months, they finally figured out that when this change was applied to a single variable in the C library it invoked a compiler bug that caused the library to be compiled in such a way that caused the kernel to fail to reset the CPU's floating point registers during a context switch. (How a faulty C library could cause the kernel to do this is still a mystery to me.) This is one of the weirdest bugs I've experienced, though I'm not doing it justice here due to fading memory.
Pablo? Come to Florida honey, we miss you. (Score:3, Funny)
Ooooooooooooh well.
inc vs. add (Score:3, Interesting)
Anyway, our instructors were physics profs who focused on the hardware and never really put any effort into describing the instructions available on an 8080. We had been working at an extremely low level of logic design. At one point we had to write a program to add two numbers and display the results, and I actually wrote one looking something like
I was truly dreading doing multiplication and division, but fortunately someone pointed out the basic math opcodes first.
You think YOU had a rounding bug???? (Score:5, Interesting)
This was a major issue, because when the interrupt was lost the system froze up and had to be rebooted (this is an embedded app - not a desktop).
I offered to assist the engineer responsible for this code. We spent two days tracing the problem in extreme detail, checking and cross-checking our results. We both concluded that the processor was simply "losing" the interrupt. There was no rational explanation. We adopted the countermeasure of using a fine grain watchdog timer to look for the lost interrupt. This isn't the best solution, since what was to keep the watchdog interrupt from being lost??? But it was the best we could do. And it worked.
The project lead, however, was very unhappy with our solution. He was convinced that we had overlooked the cause of the problem, which had to be software-based. I countered that, though he could certainly be right, it would be better to leave the watchdog in and let the project move ahead until we stumbled across the real cause in due time. He reluctantly accepted this approach.
My vindication took five months, but what sweet irony when it did. It turned out that some other company, which also used the 54X chip, had encountered the same problem, but they figured it out (and I'll never know how). The problem was that the 54X (at that time) had a silicon flaw that, when certain integer rounding instructions executed at the same instant that an interrupt were being asserted, the interrupt could be "lost". This was confirmed by TI to be a silicon fault, and no amount of software handstands or cartwheels could fix it. The only workaround was to not use those rounding instructions!
OK- top that....
6502 microcode bugs... (Score:5, Interesting)
An indirect jump where the source address was on a page boundary caused the high-byte to be pulled from the beginning of the current page, instead of the beginning of the next page..
eg.
$0100 holds $80
$01FF holds $32
$0200 holds $14
then the command
JMP ($01FF)
would load the program counter with $8032, instead of $1432
First time I saw it used was in some copy-protection code in the C64 version of Sim City.. It was some obfusication to screw up beginning crackers.. (it threw me for about 5 minutes..)
Ahh, those were the days
Best Error Message Ever... (Score:5, Funny)
The buttons below were pretty cool too. One said "ok" and the other one said "lame!"
If you clicked the lame! button, you just got to fill out a little comment card, but the feature cracked me up the first couple times I saw it.
Re:Best Error Message Ever... (Score:3, Funny)
A link. [mackido.com]
Some examples:
"You can't modify a constant, float upstream, win an argument with the IRS, or satisfy this compiler"
"type in (cast) must be scalar; ANSI 3.3.4; page 39, lines 10-11 (I know you don't care, I'm just trying to annoy you)"
"Too many errors on one line (make fewer)"
Re:Best Error Message Ever... (Score:3, Interesting)
The buttons below were pretty cool too. One said "ok" and the other one said "lame!"
The lame thing was a hack on the dialog code. BillG made a fairly big deal out of bad or confusing error messages, so the devs got the idea to do internal builds with the extra button on every dialog so that you could report a confusing message on the spot. Pretty cool, actually.
AMI BIOS and beeping console (Score:4, Interesting)
After some testing on different computers, we discovered that it only crashed on machines with an AMI bios. Phoenix BIOS machines worked just fine, and so did real IBM machines. We never digged into the BIOS code to figure out what the problem was, but we mentioned it to the Phar Lap support people (those people were the smartest support people I ever ran across). They told us that they knew about the bug, and even explained what was happening inside the bios to make it crash the machine, but it's been 10 years so I don't remember the details anymore.
I know, it's a feature. (Score:5, Interesting)
My favorite bug in slashcode is that clicking "Parent" in my default story view always returns the default story view, not the parent of the post I'm clicking on. So I have to click on the post ID number, then click parent on the resulting page.
Re:I know, it's a feature. (Score:4, Informative)
spelling of functions (Score:3, Funny)
All of the function names with the word 'colour' were spelled 'color.'
It's kind of like the MSFT bastardisation of SQL. ("Select * from table" compared to "Select # from table".)
Debugging bugs (Score:4, Funny)
I remember discovering __LINE__ and __FILE__ when I was doing some perl debugging. It was handy to do stuff like:
do(something()) or die("Failed on line " . __LINE__);
Of course, then I had this idea of using a debugging function (this is before I knew of warn,croak,carp, et al). So I happily wrote my function
sub debug { die("Failed on line " . __LINE__); }
And then spent hours trying to figure out why my code always failed on line 78, which happened to be where the debug() function lived. D'oh!
NT Backspace Bug (Score:3, Informative)
My favorite compiler bug (Score:3, Interesting)
If you had a variable that happened to be the same as the name of a function, then the compiler wouldn't complain, but it would use the address of the function as the value of the variable. Took me a **long** time to figure out where it was getting that value from.
VS 6.0 getline() bug (Score:3, Informative)
http://support.microsoft.com/default.aspx?scid=kb; EN-US;q240015 [microsoft.com]
Now, I wasted a lot of time, but eventually confirmed on the web that this is a known bug in the Microsoft C++ library which has persisted from Visual Studio 5 into version 6.
Apparently, the Standard C++ Library used in both products was produced by Dinkumware and they, with their illustrious author/founder P. J. Plauger, were embroiled in a multi-year copyright dispute which made it impossible for them to debug (let alone update) the library. Most of the commenters online seemed to believe that this problem could not be solved and we had to wait for the copyright battle to be resolved (it has).
My impression is that Microsoft has elected not to provide an update to the library (which includes the STL) until the release of .NET.
Bugs in DOS (Score:4, Interesting)
It's turn-back-the-clock time, boys and girls. Remember all of those DOS calls? It was interrupt 20, wasn't it? Remember the findfirst and findnext functions that would get you a list of the files in a directory? You could give findfirst a list of attributes and a filespec, and it would give you a file that matched it (findnext just repeated the last findfirst). Valid attributes to pass were the archive flag, read-only, directory, etc. Except the directory one didn't work! It was simply ignored, so you had to sort out what files were directories or not yourself. What a pain in the ass! And did they ever fix it? I'll give you one guess.
Oh, and I can't mention old MS bugs without mentioning MASM vs TASM (just because it illuistrates why Borland is so cool and MS is not). Back in the day, when applications were coded in assembler, MASM (Microsoft Macro Assembler) was popular as hell. Borland, though, came out with Turbo Assembler, which had a better syntax (optionally), could assemble MASM syntax faster than MASM could, and could emulate all the bugs in the different versions of MASM. Ah.
Well, that's enough MS bashing for me today (or maybe just this hour...).
When comments are more than comments... (Score:4, Funny)
Back in the day when I used to program in C++, I was also really into making little ascii-art comments in my code. One time I had some code that looked like this:
#include <stdio.h>
// tom 7 was here - 1998 \\
typedef unsigned char uchar;
int something(uchar c);
...
(In actuality, the code was longer and more complicated, so it wasn't so easy to figure out...). Can you see the bug?
Re:When comments are more than comments... (Score:3, Funny)
Ha ha.
at an old data center I was at.. (Score:3, Funny)
Machines that stay running for years at a time almost never come back up cleanly after some downtime, and I can't recall the cases where walking back to the beast and planting a kick into it's chassis would "fix" the problem. We particularily enjoyed doing this to aging RAID arrays and four digit sun machines because of the amount of effort needed to get the things out of the rack and opened up.
Now most of us would realize that this was probably just reseating whatever needed reseating, but the humor value behind skilled techs fixing expensive hardware with violence is too tempting to resist.
Re:at an old data center I was at.. (Score:4, Funny)
A common problem was that the heads on the hard drive would get stuck, and the machine would cease to operate. The standard operating procedure to remedy this was told to me as:
If that didn't work, secondary protocol was to remove the hard drive from the machine, place it on the desk, and hit it three or four times with the blunt end of a screwdriver.
According to the techs, this worked about 90% of the time.
Two days to deadline, lets add some security… (Score:3, Insightful)
A few years ago I was working as the lead programmer on a cd-rom game. Two days before deadline, the manager of the project decided that we should implement a copy protection.
Now you can see where it is going... right?
Well the manager had talked to the company who was going to print the cd-roms. They had this piece of software that would protect the system. All we had to do was to write a component that needed to be called in order to start the game. If this component weren't called at first the game wouldn't start. We thought about it for some time. As we only had two days, we decided to let the component write down an encoded string, based on the current date to the harddisk, and then inside the game, well hidden read the string and match the date. As I have coded the game I made the part inside the game, while an other developer made the start-up component. I designed the specification of the coded string. It contained a lot of crap, and well hidden, the two digits indicating the day.
Now I coded my part in such a way that it would work 4 days after the date. (Allowing me to more easily bypass midnight at the end of the month - especially February). This would hopefully also put off hackers, as the game would appear to be hacked, as the coded string would work for a few days.
We tested the system, especially the end of months, going from the 28-31st to the 1st. It was end of November, close to Christmas - therefore the hurry. Then the cd-roms went into print.
4 of December I received one of the first copies, just as the packages was prepared to be send out to the shops. I put it into the computer, and it failed... I tried again... and again. The way the program terminated looked subspecialty like the protection, so I started to look closely into what was happening. It was the date. 4 of December were a single digit. The protection component wrote 40 while the game looked for 04... My fellow developer had misunderstood the specifications. Of cause testing for 31 would work... it was two digits.
We trashed all the cd-roms and made a new version without protection. Our manager will probably not ask us to do such a change with such short notice an other time.
A thought thou; The cd-roms would have worked on Christmas eve... its two digits, but a new year... he he he.
'Bug' in custom chip (Score:5, Funny)
Of course, I eventually figured out that the original problem was ground bounce and that with Vcc disconnected, the chip was getting power through the protection diodes on the control lines and bus. The lower voltage was slowing down the edges and reducing the ground bounce so that it worked correctly. I eventually solved the problem with PCB layout changes and the chip started working with Vcc connected!
How to BSOD Windows.. (Score:3, Interesting)
main () {
for (;;) {
printf ("Hung up\t\b\b\b\b\b\b")
}
}
More information is available at:
http://homepages.tesco.net/~J.deBoynePollard/FG
This is why I don't run windows.
Apple III (Score:3, Funny)
The Apple III was a much unloved "business" computer, essentially a business upgrade to the Apple ][ line. It was pretty expensive, $4k I think, which helped it be unloved.
It had some loose connectors in some of the chips. They weren't very snug in the bboard and could get loose. The Official Apple solution was to put the Apple on a hard surface, lift the front to roughly a 45 degree angle, and drop it to reseat the chips. I can imagine the look on the face of the owner upon seeing their expensive comp wandering to the the back room, a loud THUD, then returning with it "fixed".
1976 Cobol programmer's bug (Score:3, Interesting)
READ A,E,I,O,U
[...]
X=A+E+I+0+U
See the problem? Note that in 1976, programmers would write their code on a form that was given to keypunch operators, who "typed" it onto 80-column punch cards that were then fed into the computer. When the author got back from vacation, I refrained from punching him in the face, and just yelled at him instead.
General Motors (Score:3, Funny)
---
This is a real story happened between the customer of General Motors and its customer-care executive..
This complaint was received by the Pontiac Division of General Motors: This is the second time I Have written to you, and I don't blame you for not answering me, because I sounded crazy, but it is a fact that we have a tradition in our family of ice cream for dessert after dinner each night. But the kind of ice cream varies so, every night, after we've eaten, the whole family votes on which kind of ice cream we should have and I drive down to the store to get it. It's also a fact that I recently purchased a new Pontiac and since then my trips to the store have created a problem. You see, every time I buy a vanilla ice cream, when I start back from the store my car won't start. If I get any other kind of ice cream, the car starts just fine. I want you to know I'm serious about this question, no matter how silly it sounds: "What is there about a Pontiac that makes it not start when I get vanilla ice cream, and easy to start whenever I get any other kind?"
The Pontiac President was understandably skeptical about the letter, but sent an engineer to check it out anyway. The latter was surprised to be greeted by a successful, obviously well educated man in a fine neighborhood. He had arranged to meet the man just after dinner time, so the two hopped into the car and drove to the ice cream store. It was vanilla ice cream that night and, sure enough, after they came back to the car, it wouldn't start. The engineer returned for three more nights. The first night, they got chocolate. The car started. The second night, he got strawberry. The car started. The third night he ordered vanilla. The car failed to start. Now the engineer, being a logical man, refused to believe that this man's car was allergic to vanilla ice cream. He arranged, therefore, to continue his visits for as long as it took to solve the problem. And toward this end he began to take notes: he jotted down all sorts of data: time of day, type of gas uses, time to drive back and forth etc. In a short time, he had a clue: the man took less time to buy vanilla than any other flavor. Why? The answer was in the layout of the store. Vanilla, being the most popular flavor, was in a separate case at the front of the store for quick pickup. All the other flavors were kept in the back of the store at a different counter where it took considerably longer to check out the flavor.
Now, the question for the engineer was why the car wouldn't start when it took less time. Once time became problem - not the vanilla ice cream, the engineer quickly came up with the answer: "Vapor lock". It was happening every night; but the extra time taken to get the other flavors allowed the engine to cool down sufficiently to start. When the man got vanilla, the engine was still too hot for the vapor lock to dissipate.
Remember: Even crazy looking problems are sometimes real and all problems seem to be simple only when we find the solution with a cool thinking. Don't just say its "IMPOSSIBLE" without putting a sincere effort... Observe the word "IMPOSSIBLE" carefully... You can see "I'M POSSIBLE"... What really matters is your attitude and your perception.
Re:Pet Bugs? Oh Yes! (Score:4, Interesting)
Re:Not a bug (Score:3, Informative)
NO!!!!!!
Please don't take this as a flame, because I'm not upset with you, just the ignoramuses that came up with this scheme. This is a stupid way define ROUND(), and I disagree entirely with the justifiction because ROUND() has to be defined in the case that the digit is a zero, right?
In other words,
digits 0,1,2,3,4 get rounded DOWN
digits 5,6,7,8,9 get rounded UP
See - it's completely even without this odd/even cockamamie bullstuff. In fact, this definition of ROUND() throws off the statistics because it inappropriately weights the UP/DOWN results (either 50/50 or 60/40) based on info that is irrelevant to the ROUND() process.
It's like the people who coded this function never studied actual math and don't understand that the trivial case (zero) counts!
I'm sorry, I don't usually go off like this but when something this simple gets this fscked up, it really frosts my wheaties.
Re:An oldy but a goody (Score:4, Funny)
If they had a sense of humour, they would have shipped version 1.0999999.
Re:how 'bout HTML bugs? (Score:3, Informative)