Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / I THINK IM GOING CRAZY

Author
Message
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 16th Mar 2004 04:56
HOW CAN AN ARRAY BE ACCESSED OUT OF BOUNDS WHEN FUNCTIONS USE VALUES TO GAIN ACCESS TO THEM WHEN THEY ARE GLOBAL?

FUNCTION VECTOR_CROSS_PRODUCT(VECTORW#,VECTORU#,VECTORV#)
U=INT(VECTORU#)
V=INT(VECTORV#)
W=INT(VECTORW#)
X=0
Y=1
Z=2

VECTOR#(W,X)= (VECTOR#(U,Y)*VECTOR#(V,Z))-(VECTOR#(U,Z)*VECTOR#(V,Y))
VECTOR#(W,Y)=(-1.0*VECTOR#(U,X)*VECTOR#(V,Z))+(VECTOR#(U,Z)*VECTOR#(V,X))
VECTOR#(W,Z)= (VECTOR#(U,X)*VECTOR#(V,Y))-(VECTOR#(U,Y)*VECTOR#(V,X))
ENDFUNCTION
John Y
Synergy Editor Developer
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: UK
Posted: 16th Mar 2004 10:30
out of bounds means that you have tried to get an index out of an array that doesn't exist, not that it is out of bounds as in your not allowed to access it.

Your probably doing something like this:

Dim myArray(10)

myArray(15) = 20

This is called out of bounds because the array 'myArray' only has 10 places 0,1,2,3,4,5,6,7,8,9 and so there is no place to put the value 20 into position 15

Level Maker 3D: www.levelmaker3d.co.uk/levelmaker3D.asp
DarkBasic Professional Editor: www.levelmaker3d.co.uk/ide.asp
also: www.levelmaker3d.co.uk/KrazyKarts/ & www.DigitalOmega.Net
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 16th Mar 2004 17:06
i understand what you are saying but the array isnt out of bounds. its just a bug. if you look at my code carefully, whats going on is a global dimension is created to hold vectors like this dim
vector#(1,3). then a value is stored like this vector#(0)=0.0 and is passed into the function to know what vector# to access. its a bug.

Login to post a reply

Server time is: 2025-05-22 21:53:36
Your offset time is: 2025-05-22 21:53:36