in reply to Strangness with arrays

japhy++ for the right explanation. I just want to add that when you get strange behaviour, your first thought should be to alter your test case. Generate other sequences. Use rand(). Try to see when it behaves the way you expect it to, or don't.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: Strangness with arrays
by BrowserUk (Patriarch) on Jul 10, 2002 at 20:46 UTC

    Good suggestion well taken. My only (pathetic)defense is, that bit was working........

    Granted, I couldn't explain why it was working but, but.............

    {hangs head in shame!}


    Anyone know of an abbottoire going cheap?

      No shame.. everyone makes boneheaded mistakes. It took me a couple of those before I understood that same advice I just gave you, and I sometimes still have to remind myself that it may only be a coincidence with the chosen test case.

      Pragmatic lesson I took home: when testing code, generate two random and reasonably large test cases to run it against. Even if one of the data sets happens to display strange behaviour, odds that they both do in the same way are rather low.

      Makeshifts last the longest.