[fpc-devel] Pointer cache for fast class/pointer access.

Sergei Gorelkin sergei_gorelkin at mail.ru
Thu Jan 5 13:00:58 CET 2012


05.01.2012 15:45, Marco van de Voort пишет:
> In our previous episode, Sven Barth said:
>>> Object instead Class?
>>
>> They are basically similar to "records with methods" (which we now have
>> as well...) if you use them directly (this means: not as pointer types):
>> they are located on the stack and nested objects are part of the memory
>> structure of the object. But if you use references to objects you work
>> more like with classes as you have constructors, virtual methods and the
>> objects are then located on the heap (thus you need to care for the
>> memory management yourself).
>
> Afaik records with methods is more advanced since they are initialized.
>
> Afaik stack based TP Objects are not initialized and thus not safe for
> automated types. (I looked into upgrading TV with ansistring a few years
> back)
>
This is no longer correct, stack based objects are initialized and finalized if necessary.
There was indeed an issue with inheritance (if both ancestor and descendant contain managed members, 
then members of ancestor were not handled), but I personally fixed that in r16335 a year ago.

Sergei



More information about the fpc-devel mailing list