> On Apr 6, 2017, at 4:26 PM, Sven Barth via fpc-pascal > <fpc-pascal@lists.freepascal.org> wrote: > > It's a difficult topic, cause in Object Pascal class instances are always on > the heap while in C++ they might be on the stack as well. Thus a C++ compiler > will insert calls to the destructor of such an object if it goes out of scope. > > In Object Pascal currently only reference counted interfaces and (new in > trunk) records with management operators provide this feature.
I see, but since there is a reference to an instance on the stack wouldn’t it be trivial for the compiler to invoke a method on TObject descendants when they go out of scope? If it does it for compiler types like dynamic arrays I imagine it could do the same for classes. Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal