Slashdot Mirror


The Exact Cause of the Zune Meltdown

An anonymous reader writes "The Zune 30 failure became national news when it happened just three days ago. The source code for the bad driver leaked soon after, and now, someone has come up with a very detailed explanation for where the code was bad as well as a number of solutions to deal with it. From a coding/QA standpoint, one has to wonder how this bug was missed if the quality assurance team wasn't slacking off. Worse yet: this bug affects every Windows CE device carrying this driver."

4 of 465 comments (clear)

  1. Bigger bugs have gotten through on Windows CE by msgmonkey · · Score: 5, Interesting

    For example I had some code I developed on Windows CE 4.2 .NET which kept on hanging on calling the FindWindow() fuction call.

    Turns out that trying to find a window by class name will hang (this version of) CE every time, even though you would have thought its a very much used function call and would be caught by CE.

    So no I'm not surprised at all that this bug got through.

  2. Re:Regardless of whatever code in it is faulty by concernedadmin · · Score: 5, Interesting

    Lines 122, 521, 690, 710, and 748 scare me; gotos in C code...

    They've used one form of a goto that's actually quite readable and useful. Would you rather have:

    if (condition1 && condition2) {
    /* boilerplate code with a return */
    }

    if (issue1 || issue2) {
    /* same repeated boilerplate code with a return */
    }

    or

    if (condition1 && condition2) {
    goto cleanup;
    }

    if (issue1 || issue2) {
    goto cleanup;
    }
    cleanup:
    /* just one instance of this code,
    no need for duplication of efforts */
    Believe it or not, there are useful reasons to use goto, and Microsoft happened to use goto for the right reason here. The Linux kernel also happens to use this practice to boost the readability of the code.

  3. Calendrical Calculations by kabloom · · Score: 4, Interesting

    The proper way to do this would be with division and modulus, which gives you a nice constant time solution even if you're still using your Zune in 2108. They ought to read Calendrical Calculations by Nachum Dershowitz and Ed Reingold and learn how to do this properly.

  4. Re:Regardless of whatever code in it is faulty by QRDeNameland · · Score: 4, Interesting

    The addition of single bool avoids both the specialized cleanup() function and the goto:

    bool needs_cleanup = false;

    if (condition1 && condition2) {

    needs_cleanup = true;

    }

    if (issue1 || issue2) {

    needs_cleanup = true;

    }

    if (needs_cleanup) {

    // clean up local vars exactly as you would have done

    // have done under the cleanup: label with the goto

    }

    --
    Momentarily, the need for the construction of new light will no longer exist.