[Lazarus] Difference between FreeThenNil and FreeAndNil

Alexander Klenin klenin at gmail.com
Wed Apr 27 09:28:30 CEST 2011

On Wed, Apr 27, 2011 at 18:15,  <michael.vancanneyt at wisa.be> wrote:
>> That's a hack to work around the fact that some destructors may
>> access the object being destroyed via the given pointer instead of
>> directly.
> Can you explain this ?
> Because to my understanding the code does exactly the same.

No, these two procedures perform assignment and destruction in a
different order -- even their names reflect that.

BTW, I think the check in FreeThenNil is redundant and should be removed.

Alexander S. Klenin

More information about the Lazarus mailing list