Restored from previous forum. Originally posted by horst.
Purebasic accepts an index beyond the range defined by DIM,
but the program may crash (or other data may be overwritten?).
It would be a great help if this would produce an "Index
beyond range" error by the compiler.
Another one:
If I use a DIM variable without index, like:
DIM bla(2)
bla = 12
this is just ignored by Purebasic (but I have not checked for
side effects.. Does it overwrite other data?)
Horst
[Implemented] DIM index range check?
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
You change the pointer to the array, so don't do this unless you really know what you're doing..If I use a DIM variable without index, like:
DIM bla(2)
bla = 12
this is just ignored by Purebasic (but I have not checked for
side effects.. Does it overwrite other data?)
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.

Disregard what i said, i was mixing things up a bit. If you for instance would have done it this way bla()=12 then my claims of changing array pointers would have been true, but you didn't do it that way, so don't read this as it will only add to the confusionYou change the pointer to the array, so don't do this unless you really know what you're doing..
