Al Boldi ha scritto:

In the fpc-rtl there is something like this:

procedure TObject.Free;
begin
 if self<>nil then self.destroy;
end;

Does this make sense?  i.e. How is it possible for self to be nil?

It happens when you try to free an object which either you didn't create, or you've already set free. The free method provides a nice way to save tests in your source code. Destroy would rise an Access violation exception, Free doesn't.

Giuliano.

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to