[fpc-devel]Proposal for audo-destructors

Nico Aragón na-list at espira.net
Sun Sep 12 14:15:05 CEST 2004


On Sun, 12 Sep 2004 13:02:52 +0200, Marc Weustink
<marc at dommelstein.net> wrote:

>>  Procedure Something;
>>  Var T:tMyClass;Auto;
>>  Begin   <- T auto created here
>>     ...
>>     If ... Then Exit; <- T auto destructed here
>>     ...
>>  End;    <- T auto destructed here
>>  P.P.S. The "auto" modifier should affect only stack
>>         There's no great need of this for global vars.
>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.

  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