[Info-vax] DEC Basic and dynamic memory ?

Craig A. Berry craigberry at nospam.mac.com
Mon Jan 31 11:16:10 EST 2022


On 1/31/22 7:55 AM, Simon Clubley wrote:
> On 2022-01-30, Dave Froble <davef at tsoft-inc.com> wrote:
>> On 1/30/2022 7:09 PM, Simon Clubley wrote:

>>>>> 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.
>>>
>>> In addition, there's the overhead of copying the tree everytime
>>> you run out of allocated spare space and need to extend it.
>>
>> Bullshit!  Just not true.
>>
> 
> Arne's example makes it very clear that when you run out of spare nodes
> in your backing storage in DEC Basic, and hence have to grow the backing
> storage by the growth increment, you have to do a copy of the existing data.
> 
> How would you grow the existing backing storage without either you or
> the DEC Basic RTL doing a copy of the existing data when you extend it
> by the growth increment ?

It's DEC BASIC, and it's not going to run on anything but VMS, so the
reasonable thing to do would be to use the RTL routines for tree
handling that Hoff mentioned way upthread.  If for some reason you
insist on rolling your own, you could certainly use LIB$GET_VM and
friends to allocate nodes as you need them and have exactly the same
algorithm you would have in C.

The fact that BASIC dynamic memory handling makes porting the compiler
more difficult (the original thread topic) has nothing to do with
whether it's the best thing to use for any particular purpose.  For tree
handling, probably not, though it certainly can be done as has been
demonstrated.



More information about the Info-vax mailing list