Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
Acmlm's Board - I3 Archive - Programming - VB6 Overflowing NES rendering... | New poll | | |
Pages: 1 2 3 | Add 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 |
| ||
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 |
| ||
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 |
| ||
Originally posted by BGNG 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 |
| ||
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 |
| ||
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 3 | Add to favorites | Next newer thread | Next older thread |
Acmlm's Board - I3 Archive - Programming - VB6 Overflowing NES rendering... | | |