Thomas (boggyb) wrote,
Thomas
boggyb

  • Mood:
  • Music:
Today's "implementation detail" was a system that defines arrays with a range 0 to N, then completely ignores the N'th element:

Dim foo(2)
foo(0) = "alpha"
foo(1) = "beta"
...
For i = 0 to UBound(foo) - 1
DoSomethingUseful(foo(i))
Next


For those of you who don't know Visual Basic, the first statement declares an array with a range of 0 to 2 inclusive. UBound returns the highest valid index in the array (in this case, 2). For added fun, there was at least three layers of functions and several thousand lines of code between the two, and Visual InterDev's debugger refused to connect to anything. So when I innocently added a foo(2) = "gamma" and expected something useful to happen, all that actually happened was nothing.

In fairness, the person responsible for that was under tight time pressures when he wrote it.
Subscribe
  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments