?

Log in

No account? Create an account
Today's "implementation detail" was a system that defines arrays with… - 'Twas brillig, and the slithy toves did gyre and gimble in the wabe [entries|archive|friends|userinfo]
Thomas

[ website | Beware the Jabberwock... ]
[ deviantArt | the-boggyb ]
[ FanFiction | Torkell ]
[ Tumblr | torkellr ]

Links
[Random links| BBC news | Vulture Central | Slashdot | Dangerous Prototypes | LWN | Raspberry Pi]
[Fellow blogs| a Half Empty Glass | the Broken Cube | The Music Jungle | Please remove your feet | A letter from home]
[Other haunts| Un4seen Developments | Jazz 2 Online | EmuTalk.net | Feng's shui]

[Tuesday 19th January 2010 at 7:30 pm]
Thomas

boggyb
[Feeling |annoyedpeeved]
[Playing |A Whisper ~ Coldplay/A Rush Of Blood To The Head]

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.
Link | Previous Entry | Share | Next Entry[ Penny for your thoughts? ]