From: Jeff Johnson on
"Tom Shelton" <tom_shelton(a)comcastXXXXXXX.net> wrote in message
news:Oi$dt3oSKHA.4004(a)TK2MSFTNGP04.phx.gbl...

>> Also you can selectively dimension by ReDim(1 to n) to start a given
>> array
>> from 1 regardless of the Option Base statement.
>>
>
> Right... And, when I was a VB.CLASSIC guy I used to be in the habbit of
> doing
> just that - explicitly declaring both bounds (even though I almost never
> used
> anything but 0). It just made things a bit more clear to me :)

Me too. ALWAYS.


From: Eduardo on
Jeff Johnson escribi�:
> "Tom Shelton" <tom_shelton(a)comcastXXXXXXX.net> wrote in message
> news:Oi$dt3oSKHA.4004(a)TK2MSFTNGP04.phx.gbl...
>
>>> Also you can selectively dimension by ReDim(1 to n) to start a given
>>> array
>>> from 1 regardless of the Option Base statement.
>>>
>> Right... And, when I was a VB.CLASSIC guy I used to be in the habbit of
>> doing
>> just that - explicitly declaring both bounds (even though I almost never
>> used
>> anything but 0). It just made things a bit more clear to me :)
>
> Me too. ALWAYS.

What I usually do is to set just the upper bound and leave the lower
bound in zero, but I use the array from 1 and ahead.
I discard the first element.

I always lose one element space, but I have other advantages:
a) start counting with 1 (it's natural and easy)
b) an array with zero elements has different upper bound than an array
with one element.
c) The array is always dimensioned.

From: Bill McCarthy on


"Eduardo" <mm(a)mm.com> wrote in message news:hb5gbq$ch5$1(a)aioe.org...
> Jeff Johnson escribi�:
>> "Tom Shelton" <tom_shelton(a)comcastXXXXXXX.net> wrote in message
>> news:Oi$dt3oSKHA.4004(a)TK2MSFTNGP04.phx.gbl...
>>
>>>> Also you can selectively dimension by ReDim(1 to n) to start a given
>>>> array
>>>> from 1 regardless of the Option Base statement.
>>>>
>>> Right... And, when I was a VB.CLASSIC guy I used to be in the habbit of
>>> doing
>>> just that - explicitly declaring both bounds (even though I almost never
>>> used
>>> anything but 0). It just made things a bit more clear to me :)
>>
>> Me too. ALWAYS.
>
> What I usually do is to set just the upper bound and leave the lower bound
> in zero, but I use the array from 1 and ahead.
> I discard the first element.
>
> I always lose one element space, but I have other advantages:
> a) start counting with 1 (it's natural and easy)
> b) an array with zero elements has different upper bound than an array
> with one element.
> c) The array is always dimensioned.
>

The problem is for anyone else using your code, they are faced with arrays
with an unused element, yet they can't tell that if it is an intrinsic type
such as a numeric type, date or for that matter a string. And if they do a
For Each your habits stuff that up completely.










From: Bill McCarthy on


"Jeff Johnson" <i.get(a)enough.spam> wrote in message
news:OYb12mPTKHA.4364(a)TK2MSFTNGP04.phx.gbl...
> "Tom Shelton" <tom_shelton(a)comcastXXXXXXX.net> wrote in message
> news:Oi$dt3oSKHA.4004(a)TK2MSFTNGP04.phx.gbl...
>
>>> Also you can selectively dimension by ReDim(1 to n) to start a given
>>> array
>>> from 1 regardless of the Option Base statement.
>>>
>>
>> Right... And, when I was a VB.CLASSIC guy I used to be in the habbit of
>> doing
>> just that - explicitly declaring both bounds (even though I almost never
>> used
>> anything but 0). It just made things a bit more clear to me :)
>
> Me too. ALWAYS.

Ditto. I find it also helps people less familiar with VB, or those who swap
back and forth between languages to remember the array is dimensioned by
upper and lower bounds not count of elements.

From: Eduardo on
Bill McCarthy escribi�:

>> What I usually do is to set just the upper bound and leave the lower
>> bound in zero, but I use the array from 1 and ahead.
>> I discard the first element.
>>
>> I always lose one element space, but I have other advantages:
>> a) start counting with 1 (it's natural and easy)
>> b) an array with zero elements has different upper bound than an array
>> with one element.
>> c) The array is always dimensioned.
>>
>
> The problem is for anyone else using your code, they are faced with
> arrays with an unused element, yet they can't tell that if it is an
> intrinsic type such as a numeric type, date or for that matter a
> string. And if they do a For Each your habits stuff that up completely.

I usually don't use variants. And I don't use For Each with arrays.
But yes, I it could be a bit confusing to someone.
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
Prev: Array of pointers
Next: Will this object get destroyed?