Consider this short Delphi procedure:
procedure TfrmXQuery.FieldListFillFromDefault;
var
field_list: TStringList;
begin
try
if x <> '' then begin
field_list := TStringList.Create;
{do some stuff with field_list}
end;
finally
if field_list <> NIL then
begin
field_list.Free;
end;
end;
end;
When I run this in, Delphi 3, with x = '' so that field_list is never created,
- why is
field_list <> NIL
? - are objects not initialized as
NIL
? - if it's not
NIL
what is it? - and if it's unassigned and not
NIL
how do I know whether or not toFree
it? TheAssigned
function does not tell me:if Assigned(an_object)
is equivalent toif an_object = NIL