[futurebasic] Re: [FB] Records (Part 1 - Booleans)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2001 : Group Archive : Group : All Groups

From: Michael S Kluskens <mkluskens@...>
Date: Sat, 15 Dec 2001 10:53:29 -0500
At 9:12 AM -0600 12/15/01, jktr wrote:
>  >dynamic gFnCall(_maxInt, _maxInt) as boolean
>>
>Bernie,
>
>You will still have a problem with this code, because dynamic arrays are
>dynamic in only the first dimension. That means if you assign a value to
>gFnCall(0,0), your array will already have 32,768 bytes. Use
>gFnCall(9,6), and the size of your array zooms to 3,276,800 bytes.

An alternative to pointers and other approaches is to have three 
dynamic arrays, one is the first index and has the index value where 
the data starts in the third array, the second has the number of 
items for each set of values in the third array.  Sometimes pointers 
are easier or faster and sometimes not (my explanation is probably 
not clear, I'll do an email example if asked), all depends on how 
your data gets built.

Until dynamic arrays there was no easy way to build structures with 
the undetermined size of linked lists and the speed of arrays, the 
trick is figuring out how to take advantage of the dynamic arrays for 
more than one dimension.  I didn't take to dynamic arrays right away 
but now every one dimensional array in my program is a dynamic array 
(except containers, can't mix the two yet, build a dynamic array of 
handles instead the guys here say), and anytime I start thinking of a 
two dimensional array I back track and figure a better way using 
several dynamic arrays.

One of my recent projects in another language used a complicated 
linked list tree structure (or whatever it would be called) and made 
heavy use of pointers, it was dog slow and I had to kill it. 
Unfortunately that language, Fortran 90, does not have dynamic 
arrays, the closest you come is creating a second array, copying your 
data over, deallocating and reallocating the original array, copy 
your data back, and deallocating the temporary array.  FB^3 might do 
something similar I don't know but we don't have to deal with that 
and it makes life much nicer.  Now if FB^3 just did complex variables 
( 1 + i 2 ) where i=sqrt(-1).....

-- 
Michael Kluskens <mkluskens@...>

Got a question? The answer is "I don't do windows."