Become a fan of Slashdot on Facebook


Forgot your password?

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?
This discussion has been archived. No new comments can be posted.

Pet Bugs?

Comments Filter:
  • by A nonymous Coward ( 7548 ) on Wednesday June 26, 2002 @03:55PM (#3771692)
    Round to the nearest even digit if the truncated value is .5 Otherwise there's a slight upward bias.
    • I guess it depends on the documented behaviour of VB's round function. Anyone brave enough to wade through MSDN for it?
      • From MSDN... (Score:3, Informative)

        by bje2 ( 533276 )
        "When you convert a decimal value to an integer value, VBA rounds the number to an integer value. How it rounds depends on the value of the digit immediately to the right of the decimal place--digits less than 5 are rounded down, while digits greater than 5 are rounded up. If the digit is 5, then it's rounded down if the digit immediately to the left of the decimal place is even, and up if it's odd. When the digit to be rounded is a 5, the result is always an even integer." so, Ed is correct...the round function is working to the documentation...
    • by MSwanson ( 99458 ) on Wednesday June 26, 2002 @04:00PM (#3771754)
      It's not MSDN, but here's a reference: ref/round.html []
    • by coyote-san ( 38515 ) on Wednesday June 26, 2002 @04:21PM (#3772001)
      There are actually something like 4 different IEEE rounding functions. I'm pretty sure this one, "round towards even," is the most commonly used as a default since it introduces the least bias in the results.

      The others, from memory so they may be off, are:

      - round towards zero. (.45 rounds to .4, -.45 rounds to -.4)

      - round towards -infinity (.45 rounds to .4, -.45 rounds to -.5 and thence to -1.0)

      - round towards +infinity (.45 rounds to .5 (and thence to 1), -.45 rounds to .4)

      and possibly round towards infinity (.45 rounds to .5 and thence to 1, -.45 rounds to -.5 and thence to -1), but I'm not sure this mode actually exists since it would tend to inflate values during very long computations.

      You should be able to control the behavior by some obscure function that nobody ever remembers.
    • by Anonymous Coward on Wednesday June 26, 2002 @04:24PM (#3772034)
      shouldn't round(82.845) return 83?
  • by Cleon ( 471197 )
    MS Visual Studio. The whole thing.

    The compiler is weird, the debugging is painful, and the linker is just plain wonky.
  • by tenman ( 247215 ) <slashdot,org&netsuai,com> on Wednesday June 26, 2002 @03:56PM (#3771698) Journal
    Here is the first ever computer bug... []

    back with more in a minute
  • not estimating.

    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)

    by Ethidium ( 105493 ) <chia_tek@ y a h o o . c om> on Wednesday June 26, 2002 @03:56PM (#3771702) Homepage Journal
    Under some rounding schemes, .845 should round to .84

    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)

      by jeffy124 ( 453342 )
      IIRC, IEEE wanted to set the standard to round up one half the time, down the half, resulting in balance. But the IRS and every corporation out there would see that as losing money (a penny was worth something back then), so they opted for always rounding up if the deciding digit was 5.
  • Ah, so! (Score:2, Funny)

    No wonder my banker is always smiling when he sees me -- he's using VB script!

  • by kwishot ( 453761 ) on Wednesday June 26, 2002 @03:57PM (#3771706)
    All those times when slashdot is messed up and you click on a comment only to be brought back to the front page...
    • Slashdot Slashdotted (Score:5, Interesting)

      by No Such Agency ( 136681 ) <abmackay@gmail.REDHATcom minus distro> on Wednesday June 26, 2002 @04:43PM (#3772262)
      "All those times when slashdot is messed up and you click on a comment only to be brought back to the front page..."

      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)

    by WinDoze ( 52234 ) on Wednesday June 26, 2002 @03:57PM (#3771708)
    I discovered that Visual Basic has a bug where it turns otherwise comptent programmers into drooling incompetent weenies. Our solution was to take these people and put them into marketing.
  • The documented in-memory format for dialog boxes up to Win '98 (the last version I programmed for) was totally wrong in MSDN. I spent weeks on that (dynamically creating forms under Forth so there wasn't much chance of getting MS to help!).

    More of a documentation error than a bug but it had the same effect on my sanity!


  • I vaguely remember hearing of a Cosmac (?) 1802 bug, where if the instruction following (before?) an Enable (Disable?) Interrupts was even (odd?) parity, the instruction was a no-op. You can see I'm not all that good at remembering 25 year old stories for processors I never used....
  • 82.84499 (Score:3, Informative)

    by Coward, Anonymous ( 55185 ) on Wednesday June 26, 2002 @03:58PM (#3771720)
    Floating point numbers have problems with precision, your computer can not store 82.845 in a floating point number so the number it stores is slightly less than 82.845 which VB correctly rounds to 82.84
  • Heisenbugs (Score:4, Funny)

    by Mozz Alimoz ( 245834 ) on Wednesday June 26, 2002 @03:58PM (#3771723)
    You know the kind. When you add in debug they go away.
  • I don't know why everyone raves about these compilers... everytime i go to compile something they just spit out error after error. How does the open source community survive without being able to compile VB? oh... wait... gcc isn't for vb? nevermind...
    • Actually, I found quite a strange bug in gcc 2.95. Even with *all* optimisations disabled, this is the result I would get:

      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;
      complex_expression(dosomething(arg1 , arg2, arg3, a));

      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)

    by peterdaly ( 123554 ) <<moc.mocten.xi> <ta> <yladetep>> on Wednesday June 26, 2002 @03:59PM (#3771732)
    We have a spider that comes crawling around our cubes every now and then. We don't kill him, figuring he helps keep the other bug populations inside down. We call him our little web developer.

    I'm serious.

  • This isn't a bug so much as a crack-headed design, but PHP has some of my favorite problems, in that everytime you touch an object, it makes a copy
    Meaning that function() will not be sent $object, but a copy of $object. I spent a long time, after writing a system, finding each little place and putting & chars in there. Sometimes it was impossible to do, and most of the time, there was really no way to warn me if an object was copied.
    • Err... isn't this pretty common among programming languages? My C and Pascal are a little rusty (I have spent the last three years sentenced to protocol diagnosis), but isn't the default parameter passing behavior to pass by value, and only pass by reference (making it variable) upon request?

      Sounds like data protection to me, not crack-headed design.

  • OK, this isn't necessarily a bug, but it's one of my most memorable "stupid previous programmer" rants. The code was a mess, but the variable names we horrific. Consider:

    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..."

  • I found a bug in the Ultrix C compiler. I had an implementation of DES that I had written for my security class that used bitfields. When I tried to compile it under Ultrix, the compiler went into an infinite loop. The code compiled fine with every other compiler I could find (cc on our Sun 3 boxes and gcc on several platforms).
  • older eds (Score:2, Funny)

    by onShore_Jake ( 80260 )
    There is a site I sometimes visit called "slashdot". It is a "daily".
    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)

    by Bigmell ( 129905 )
    I donno if this counts but I had a hell of a time (an entire semester!) figuring out why one of my animations worked properly then after a while (when idling) everything just shifted to the center (0,0,0)

    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!" :)
  • by TibbonZero ( 571809 ) <> on Wednesday June 26, 2002 @04:03PM (#3771783) Homepage Journal
    You can get a TI-8x to say that there is a negative Kelvin temperature, by converting a negative Celcius to Kelvin, but according to TI, it's where you put the negative symbol, however, none of the other Temp converters screw up with the negative numbers.

  • by querist ( 97166 ) on Wednesday June 26, 2002 @04:03PM (#3771785) Homepage
    About a year ago I was using the then "Technology Preview" version of Corel Linux while in grad school (I went back to school for a MSc in CIS). While working on my AI project, a neural networking toolkit in Java, I could not get the nets to learn. After over two weeks, and within days of the end of the semester, I was desperate and copied my code onto a floppy and tried it during lunch at the office, and it worked!

    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.

  • When I recently redesigned my site [], I spent time creating a fairly robust table/css layout scheme. I implemented it and checked it in a variety of browsers... Including Lynx and Opera, just for you zealots/bigots.

    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.
  • The VisualC++ linker will occasionally get into a state where it freezes up, doesn't use any CPU time, and can't be killed. The only way to get rid of it is to reboot, usually via the magic button on the case.
  • by SuperMallen ( 156287 ) on Wednesday June 26, 2002 @04:04PM (#3771799) Homepage Journal
    I worked a wicked long time ago on the HotJava browser, and we were forever running into strange behaviors in the ways IE and Netscape handled what looked like normal HTML tags.

    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.
    • This is a popular, popular bug. A look at the NS rendering engine, I've heard, shows that NS always uses percentages, and in fact rounds pixel values to then nearest percentage. I have not personally browsed the code, but a quick test on a frustrating page I once did confirmed the performance. The difficulty, of course, is that your granularity goes down as resolution goes up. That is, on a 1024x768 monitor, you can have a minimum of 10 pixels in width; on a 1600x1200 monitor the minimum becomes 16.

      One of the most annoying bugs I have ever faced, as there really are only a few acceptable workarounds.


    • 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)

    by sdjunky ( 586961 ) on Wednesday June 26, 2002 @04:05PM (#3771802)
    this has to be the most memorable one.

    it's in the Linux man file

    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.
  • rounding bugs (Score:2, Interesting)

    by RussRoss ( 74155 )
    My favorite rounding bug was the floating point bug in Applesoft BASIC on the Apple II series. A loop that adds .1 repeatedly to a variable would expose it pretty quickly. It was a basic part of life for years on that machine. To this day I am still very careful about comparing floats using an EPSILON value, i.e., the equivalent of abs(x - y) EPSILON rather than x == y.

    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
  • by cachorro ( 576097 ) on Wednesday June 26, 2002 @04:05PM (#3771809)
    It was 1999 in a QA lab in Redmond, WA. Unbeknownst to the software test engineer, the daily build of Office contained experimental code which patched a neural network into the help-wizard system. The engineer, following his normal routine, installed and fired up the software on a dual 1.0 GHz PIII machine. Twenty seconds later, Clippy the paperclip became self-aware.

    "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.

  • by kawika ( 87069 ) on Wednesday June 26, 2002 @04:07PM (#3771834)
    When I go to the front page I see one set of topics. If I go to "older stuff" I see a few topics there that seem like they should be on the front page, but aren't. I haven't checked any boxes under the preferences page's "Exclude stories from home page" so I would think they would all show up.

    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?
    • Will fix that for you.
    • by mcc ( 14761 ) <> on Wednesday June 26, 2002 @04:35PM (#3772179) Homepage
      As others have noted, this isn't a bug, these are just the stories that the editors decided weren't important enough to warrant a full front-page thing. Funnily enough, these "section page only" articles tend to have much better and more insightful comments than the front page articles, because people only post there if they really care :)

      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 [], 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 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 :( Unless i'm just confused about how it's done, anyway. But it seems to be disabled, going to a non-existent sid now shows "Nothing for you to see here, move along".

      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.. "", 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?
      • Oh, crud, it's still there.. Yeah. Sorry. I didn't notice, but here it is: the several active discussions page []. These days it seems to mostly link to slashdot journals. Sorry, i somehow missed it when i was writing the parent post. I feel dumb.

        I really, really hope this is something that the /. crew doesn't mind me bringing attention to. I just think it's cool :)
  • by GregGardner ( 66423 ) on Wednesday June 26, 2002 @04:08PM (#3771851) Homepage
    I write code and then double and triple check it. I have never written code with a single bug in it; therefore all of my code is superior and secure. In fact, my OpenBSD operating system has never had a root compromise in 6 years!

    What? OpenSSH Challenge-response authentication vulnerability you say? Uh... nevermind.

    -Theo de Raadt
  • by march ( 215947 ) on Wednesday June 26, 2002 @04:09PM (#3771857) Homepage

    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....

  • by Kris Warkentin ( 15136 ) on Wednesday June 26, 2002 @04:10PM (#3771866) Homepage
    I just observed this bug a while ago while porting some software to windows. Do the following:

    fopen some file for writing.
    write some stuff.
    fseek to some offset near the beginning.
    write some more stuff.

    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.
    • Actually, it seems that this bug is a bit deeper than just the libs. One of the post below mentions the same bug in java in windows, and I have noticed that the filestream object in .Net also fail to write out its 1k buffer.

      so many systems, so much the same bug
      (or is it a feature?)
    • by tyler_larson ( 558763 ) on Wednesday June 26, 2002 @07:16PM (#3774223) Homepage
      Here's a simple program with some unexpected consequences. It works only on windows NT-based systems, including XP.

      #include <stdio.h>
      int main()
      printf(" \b\b ");
      return 0;
      To get the full effect you have to run it by double-clicking on the icon, rather than from a DOS prompt. If you want one you can run from a command prompt, replace the printf above with:
      while (1) printf(" \b\b");

      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?

  • by swm ( 171547 ) <> on Wednesday June 26, 2002 @04:11PM (#3771880) Homepage
    These are a few of my favorite bugs []

    Just to show how cool I am.

  • One of my favorites (Score:4, Interesting)

    by tuxlove ( 316502 ) on Wednesday June 26, 2002 @04:12PM (#3771886)
    Way back when, I worked for a company that produced a special version of SysV Unix. One of our developers was going through all the source code and looking for places where global variables were initialized to zero, thusly:

    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.
  • by rice_burners_suck ( 243660 ) on Wednesday June 26, 2002 @04:13PM (#3771897)
    My weirdest, most annoying bug was a software package I authored. It had over 400,000 lines of C source code took fifteen minutes to compile under Watcom, and took about an hour to execute on a 486. As it turned out, the whole program could have been implemented in about thirty lines, which execute almost instantaneously on the same computer. So I didn't know that C supported integer math expressions. So sue me.

    Ooooooooooooh well.

    • inc vs. add (Score:3, Interesting)

      by coyote-san ( 38515 )
      When I was in college, we had an introductory class to digital logic (for physics majors) with the emphasis on switches, latches, etc. We also had a single-board processor (8080) that we programmed with hand-assembled code punched into the hex keypad - one of our first projects was *always* to set up a binary->7 segment display encoder so we could read hex output instead of the binary.

      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

      l1: inc ax
      dec bx
      jnz l1

      I was truly dreading doing multiplication and division, but fortunately someone pointed out the basic math opcodes first.

  • by flatulus ( 260854 ) on Wednesday June 26, 2002 @04:13PM (#3771898)
    Get this: A few years ago I was doing real-time driver development for an embedded DSP subsystem using TI 54X processors. Months into the development, one of the processors started "losing" a serial port transmitter interrupt. This was an interrupt that (kinda like a machine gun) *MUST* fire every time, or it will never fire again.

    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....

  • by schon ( 31600 ) on Wednesday June 26, 2002 @04:13PM (#3771901)
    My all-time favourite bug is in the microcode of the 6502/6510...

    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..

    $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 :o)
  • by Master_Ruthless ( 89957 ) on Wednesday June 26, 2002 @04:17PM (#3771934)
    I found in one of the early pre-PDC builds of Visual Studio.NET. You just got a simple message box with the following text:

    "Dude- the C# compiler is out of memory. So out of memory that it can't even tell you what the error was!"

    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.
    • That reminds me of some funny error messages from an old Apple compiler.

      A link. []

      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)"
    • 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.

  • by PD ( 9577 ) <> on Wednesday June 26, 2002 @04:17PM (#3771944) Homepage Journal
    I once worked on a DOS app (about 10 years ago) that had a very strange bug. The system would lock up for no reason we could figure out. The offending statement was a printf that printed one single character (a control-G) to the screen to make it beep.

    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.
  • by Elwood P Dowd ( 16933 ) <> on Wednesday June 26, 2002 @04:18PM (#3771946) Journal
    As far as I could tell when I was using Perl, running under strict mode would make it so that print() only worked with strings that ended in \n. I can't tell you how long that takes every beginning Perl programmer to figure out. Took me a good four hours.

    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.
    • by novas007 ( 411673 ) on Wednesday June 26, 2002 @04:37PM (#3772200) Homepage
      I've had that problem before, but it's not what you think (i think). Do you use zsh? Some shells, including zsh, protect their prompt. So if you print a single line w/o a \n, the prompt overwrites it, and you never see it. I think that bash by default will just print the prompt after whatever it was you printed. Try piping it to less or something, and you'll see it IS actually there :)
  • I can't count the number of hours I spent in high school trying to figure out why my Pascal code won't compile, only to find out that it was due to american bastardisation of the english language.

    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".)

  • by mikecarrmikecarr ( 43676 ) <> on Wednesday June 26, 2002 @04:19PM (#3771961) Homepage Journal

    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)

    by rootmonkey ( 457887 ) on Wednesday June 26, 2002 @04:19PM (#3771972)
    One of my all time favorites. Just print too many backspaces and cause the window's machine to croak. Always a crowd pleaser. And the funny thing is it still works today in NT/XP ... Good details here []
  • by west ( 39918 ) on Wednesday June 26, 2002 @04:20PM (#3771987)
    Was in the C compiler in the old Ontario ICON computer, which used a variant of QNX.

    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)

    by wunderhorn1 ( 114559 ) on Wednesday June 26, 2002 @04:21PM (#3771995)
    One pretty annoying bug I've run into is that the getline() function which is part of Standard C++ Library doesn't return when you press Enter.; EN-US;q240015 []

    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)

    by Bistronaut ( 267467 ) on Wednesday June 26, 2002 @04:23PM (#3772018) Homepage Journal

    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...).

  • by Tom7 ( 102298 ) on Wednesday June 26, 2002 @04:30PM (#3772114) Homepage Journal

    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?

  • by Xzzy ( 111297 ) <sether@tru 7 h .org> on Wednesday June 26, 2002 @04:32PM (#3772132) Homepage
    ..there was the "loose connector" bug.

    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.
    • by arnie_apesacrappin ( 200185 ) on Wednesday June 26, 2002 @05:28PM (#3772777)
      At the university in my hometown, I was talking with the IT staff about their day to day maintenance tasks. Most of the end user desktops were Zenith built 386's with 20 meg hard drives.

      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:

      • Remove all items on top of the computer.
      • Lift computer at least three feet above the desk.
      • Release.

      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.

  • by Saggi ( 462624 ) on Wednesday June 26, 2002 @04:34PM (#3772162) Homepage
    Based on a true story!

    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.
  • by apuku ( 576996 ) on Wednesday June 26, 2002 @04:35PM (#3772183)
    I was trying to debug a CMOS standard-cell chip that I designed in the late 80's. The bug was elusive, only showing up occasionally and I'd written various test routines to ferret it out. I started to suspect it was something to do with the PCB layout, so I was cutting and pasting tracks. Suddenly all the test routines worked perfectly and I thought GOTCHA! My mind was almost blown when I realized that I had inadvertently cut the power trace to the chip - it was working perfectly when Vcc wasn't connected!

    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!
  • by molo ( 94384 ) on Wednesday June 26, 2002 @04:59PM (#3772442) Journal
    This program will crash Windows NT with a BSOD. This works on NT 4, Win2K, and WinXP from an *unprivelidged* account. There is no known fix available from MS.

    main () {
    for (;;) {
    printf ("Hung up\t\b\b\b\b\b\b") ;

    More information is available at: /c srss-backspace-bug.html

    This is why I don't run windows.
  • Apple III (Score:3, Funny)

    by cant_get_a_good_nick ( 172131 ) on Wednesday June 26, 2002 @05:29PM (#3772783)
    I didn't have one, but I heard from our Apple tech guy.

    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".
  • by vrmlguy ( 120854 ) <> on Wednesday June 26, 2002 @06:41PM (#3773813) Homepage Journal
    I once had to debug someone else's code that looked vaguely like this:

    READ A,E,I,O,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.
  • by ParisTG ( 106686 ) <> on Wednesday June 26, 2002 @11:00PM (#3776096)
    Here's one I just received in my email. Enjoy:


    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.

Maybe you can't buy happiness, but these days you can certainly charge it.