Page 1 of 1

Posted: Thu Oct 03, 2002 7:23 pm
by BackupUser
Restored from previous forum. Originally posted by cor.

What is the best way to check array overflow at your source.

I have a lot of arrays.

All suggestions are welcome



Using Windows 98 SE
Registered PB version : 3.30 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Sun Oct 06, 2002 2:22 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> What is the best way to check array overflow at your source.

Sorry, but I don't understand what you mean?


PB - Registered PureBasic Coder

Posted: Sun Oct 06, 2002 8:22 pm
by BackupUser
Restored from previous forum. Originally posted by tranquil.

He means how to check if he tries to write datas to an array which is out of range. for eg:

dim Test.s(1000)

test.s(1001)="bla"


One way is to check your field-value before you write to your array.

eg:

#namearray=50

dim name.s(#namearray)

position=30
if position<=#namearray
name.s(position)="blabla"
endif

The Debugger of PureBasic does not report if you try to write datas in a "Dimension out of range", which is standard in every other basic language. Fred!?

But indeed, the best way is to use linked lists.


Tranquilizer/ Secretly!
http://www.secretly.de
Registred PureBasic User

Posted: Sun Oct 06, 2002 11:20 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Originally posted by tranquil


The Debugger of PureBasic does not report if you try to write datas in a "Dimension out of range", which is standard in every other basic language. Fred!?
It's a feature, it allows us to do some nice and powerfull tricks with dimed vars.. :wink:

Posted: Mon Oct 07, 2002 12:10 am
by BackupUser
Restored from previous forum. Originally posted by fred.

I will add array check one day :).

Fred - AlphaSND