[fpc-pascal] Automatic objects

Micha Nelissen micha at neli.hopto.org
Fri Aug 4 18:13:14 CEST 2006


Marco van de Voort wrote:
>> Is it right to assume they are automatically deallocated when they go 
>> out of scope (e.g. no need to free them manually)?
> 
> The space of the object is cleaned. However if the object uses dyn memory,
> you will have to call the destructor (destroy) to make the object cleanup.

I think in theory it's possible for the compiler to automatically call
the destructor always when leaving the function (think implicit
exception handlers here), but I guess not so many people are using them
anymore in new code that it would be worth it. Would need a new keyword
or something too, as it's not backward-compatible obviously.

Micha



More information about the fpc-pascal mailing list