Personally I'm in favor of lbound=0 ubound=-1, because of my desire to write loops that work with empty arrays of the form:dkl wrote:Seeing how the changes to lbound/ubound on uninitialized arrays could break a lot of code doing @array(lbound(array)) <> NULL to check whether the array is "uninitialized", perhaps they should be reverted. Then we'd have to declare @array(lbound(array)) <> NULL as the way to check for uninitialized arrays though, instead of a check like ubound() < lbound(). An alternative is to use lbound=0 ubound=-1 instead of lbound=1 ubound=0. That can also break code, though I'd expect it to break less code.
Code: Select all
ReDim Array(N - 1)
' Iterate over all elements
For I As Integer = 0 To UBound(Array)
'Do something with Array(I)
Next I
Code: Select all
ReDim Array(N) 'Array(0) is an unused dummy element
For I As Integer = 1 To UBound(Array)
'Do something with Array(I)
Next I