[fpc-devel]Proposal for audo-destructors

Nico Aragón na-list at espira.net
Sun Sep 12 19:07:37 CEST 2004


On Sun, 12 Sep 2004 20:38:52 +0400, netsurfer at au.ru wrote:

>>Again, what if you assign T to a global var or a 
>class member ?
>>Why would you want to do that?
>>You still can declare "var T: MyClass" if you plan to 
>use T as a local
>>reference. Obviously you only declare variables as 
>automatic when you
>>want to bind its lifecycle to the current procedure.
>The problem actualy is not in automated destructors, 
>but in that the Class
>types are actually pointers in Delphi OO model. That 

IIRC, at binary level everything is in place:

  x: TSomeClass;
  { I don't know if following line would compile,
    but it could be hardcoded }
  y: array[1..SomeClass.InstanceSize] of Byte;
  x := SomeClass.InitInstance(@y);

  Nico Aragón

NOTE: na-list address only works for messages coming from lists.
Please, write to "nico" at the same domain for direct email.

More information about the fpc-devel mailing list