Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I remember the feeling when you see a module and it has an "On Error Resume Next" at the start.


In my first job, I was given a VB6 project to maintain which had a mixture of "Option Base 1" and "Option Base 0" (or unspecified, this being the default), with occasional "On Error Resume Next". This specifies the index value for the first item in an array, i.e. you could choose the default European building floors (ground floor is 0) or American floors (ground floor is 1) -- per module!

I had to convert everything to "Option Base 0" before I could start fixing the reported bugs, it was far too confusing following the arrays passed between modules being indexed starting at 0, then 1, then 0 etc.


Would not the UBound and LBound functions not solved those issues?


Yes, though I didn't know they existed.

The existing code was written with 0 or 1 as required (except where there were bugs), and frankly I think it's was better anyway to use 0 everywhere rather than LBound(x).


That’s basically how shell scripts behave by default. At least in VB it’s not the default.


Yes, but shell scripts are written on that assumption. VB code usually wasn’t.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: