Jan. 19th, 2010

torkell: (Default)
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.

May 2025

S M T W T F S
    123
45678910
111213141516 17
18192021222324
25262728293031

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 9th, 2025 04:20 pm
Powered by Dreamwidth Studios