(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
05-18-24 04:21 AM
0 users currently in Programming.
Acmlm's Board - I3 Archive - Programming - VB6 Overflowing NES rendering... New poll | |
Pages: 1 2 3Add to favorites | Next newer thread | Next older thread
User Post
Dan

Purple Leever


 





Since: 11-18-05

Last post: 6307 days
Last view: 6298 days
Posted on 05-04-06 05:00 AM Link | Quote
I believe the default is one-based. Whoever thought that one (or the whole feature of being able to set a start index for an array) up needs shot.
Guy Perfect









Since: 11-18-05

Last post: 6300 days
Last view: 6298 days
Posted on 05-04-06 06:50 PM Link | Quote
Default is 0. If you say something like "Dim Array(5) As Integer" then the indexes will be 0 through 4.
wboy









Since: 01-05-06

Last post: 6481 days
Last view: 6481 days
Posted on 05-04-06 08:02 PM Link | Quote
Originally posted by BGNG
Default is 0. If you say something like "Dim Array(5) As Integer" then the indexes will be 0 through 4.


Yes the default base is 0, although the declaration in your example will actually have the indexes 0 thru 5. Lbound to UBound confirms this.

If you declare "Option Base 1", then the indexes will be 1 thru 5, so the only way (I know of) in VB6 to declare a variable to have 0 thru 4 indexes is "Dim Array(0 to 4) As Integer" which would also effectively ignore the set Option Base even if it was set to 1.



(edited by wboy on 05-04-06 07:07 PM)
Dan

Purple Leever


 





Since: 11-18-05

Last post: 6307 days
Last view: 6298 days
Posted on 05-05-06 05:07 AM Link | Quote
I stand corrected. Although there are a lot of websites out there that believe that arrays are defaulted to one-based.
Guy Perfect









Since: 11-18-05

Last post: 6300 days
Last view: 6298 days
Posted on 05-05-06 02:30 PM Link | Quote
Yeah, there's also a lot of places that think "Dim X, Y, Z As Integer" will create three Integer variables when it will actually create one Integer and two Variants. Another thing to watch out for.
Pages: 1 2 3Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - Programming - VB6 Overflowing NES rendering... |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.006 seconds; used 365.68 kB (max 433.17 kB)