[Info-vax] DEC Basic and dynamic memory ?

Arne Vajhøj arne at vajhoej.dk
Sun Jan 30 20:03:14 EST 2022


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 the node is inserted the code walks down from the top of the tree
find parent for the new node, update either the parents left or right
node "pointer" to point to the new node and both left and right
"pointer" of the new node is set to 0.

That is fundamentally what you will do in C or Pascal as well.

I expect the code in C or Pascal to look reasonable similar.

> In addition, there's the overhead of copying the tree everytime
> you run out of allocated spare space and need to extend it.

There is some source code overhead of having to code that
manual. And I agree that part is ugly.

Runtime there is no guarantee that the copying will actually
be more expensive than all the allocation/deallocation of
a traditional solution.

Arne




More information about the Info-vax mailing list