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.

December 2025

S M T W T F S
  1 23456
78910111213
14151617181920
21222324252627
28293031   

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 4th, 2025 08:54 am
Powered by Dreamwidth Studios