How is removing dead code NOT a stability enhancement?



  • They don't want to delete three evil lines of code "this late" in Whidbey.

     http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=2baa7f6d-9e6a-46eb-a928-c0ae646fce6b



  • The whole things is a bit of a WTF.
    This is a better way :

    private DataRowState ConvertToRowState(BitArray bitStates, int bitIndex)
    {
    bool flag2 = bitStates[bitIndex];
    bool flag1 = bitStates[bitIndex + 1];

    if (flag2 && flag1)
    {
    return DataRowState.Deleted;
    }

    if (flag1)
    {
    return DataRowState.Added;
    }

    if (flag2)
    {
    return DataRowState.Modified;
    }

    return DataRowState.Unchanged;

    } // end of function
    In fact why do they do it that way ...?

    I tend to use a defined 1 for the first bit 2 for the next then 4,8,16,32, etc.

    Then bit-and or bit-or to get the values in and out.



    I guess that whole "throw Exceptio..." thing it a bit helpfull should anybody ever change the code ......




  • I realize this is a very old post, but *wow* is that freakish code.

    Having an if() block for this type of thing is tragic. Looks like they're just pulling out bits and should've used an enum or something similar.

    Multiple exit points from a function are also no-nos and should actually be shunned more than goto....

     And wow, that has got to be a terrible way to implement a bit array....sometimes I think people shouldn't be allowed to use OOP unless they know how to do things without it.


Log in to reply