[Info-vax] DEC Basic and dynamic memory ?

Dave Froble davef at tsoft-inc.com
Mon Jan 31 11:33:05 EST 2022


On 1/31/2022 8:36 AM, Simon Clubley wrote:
> On 2022-01-30, Arne Vajhøj <arne at vajhoej.dk> wrote:
>> On 1/30/2022 7:09 PM, Simon Clubley wrote:
>>> On 2022-01-30, Arne Vajhøj <arne at vajhoej.dk> wrote:
>>>> On 1/30/2022 6:54 PM, Simon Clubley wrote:
>>>>> On 2022-01-29, Arne Vajhøj <arne at vajhoej.dk> wrote:
>>>>>> In this case Simon outlined a problem where Pascal and C are obvious
>>>>>> languages and me with no Basic experience wrote some Basic code - that
>>>>>> is almost ensure an "unsual style". Or to put it another way: I am
>>>>>> (or was) a Fortran programmer and Fortran programmers can program
>>>>>> in Fortran in any language.  :-)
>>>>>
>>>>> Thanks for the demo program Arne.
>>>>>
>>>>> The approach you are forced to use in DEC Basic is way more ugly than
>>>>> doing it in C or Pascal.
>>>>
>>>> Ugly or just unfamiliar?
>>>
>>> Ugly because of all the tree management stuff you have to do for
>>> yourself that you get for free in C or Pascal.
>>
>> What is all the tree management stuff?
>>
>
> When you prune the tree, you have to mark the pruned nodes as deleted
> in the backing storage instead of just directly removing them from the
> tree and giving the memory back to the language RTL for later reuse.
>
> When you later want to add nodes to the tree, you have to search the
> backing storage looking for deleted nodes to reuse.

If you're suggesting a linear search, I guess you never considered a stack of 
unused nodes upon which one could push and pop nodes.

> In addition, you have to grow the backing storage manually when there
> are no more spare nodes available and you have to pick values for
> initial_size and growth_increment based on your expected application
> requirements.
>
> You don't have to do any of this in your code in C or Pascal.
>
> Simon.
>


-- 
David Froble                       Tel: 724-529-0450
Dave Froble Enterprises, Inc.      E-Mail: davef at tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA  15486


More information about the Info-vax mailing list