[fpc-pascal] Stack alias for ARC like memory management?

Michael Van Canneyt michael at freepascal.org
Wed Apr 25 14:41:57 CEST 2018



On Wed, 25 Apr 2018, Ryan Joseph wrote:

>
>
>> On Apr 25, 2018, at 7:05 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>> 
>> No, because it introduces additional complications.
>> 
>> We can think of extending the features of objects or advanced records.
>> Your proposal entails a very different model of handling, which matches more how objects and records are currently handled.
>
> Isn’t putting a stack based pointer inside the class syntax easiest? 
> Maybe I don’t understand but it seems to be you’re just swapping a pointer around.

It's more than that.

> After I had the idea this morning it’s appearing now that is more of optimization like “inline” or “constref" which 
> basically says “this class exists only for this scope” so the compilers knows it can not call GetMem and call the 
> destructor at the end of the scope.

The compiler does not call getmem at all. The constructor does. In fact;
it calls a class method of the object which will allocate the necessary
memory. There is, in general, no telling what this call will do.

Michael.


More information about the fpc-pascal mailing list