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
NILwhat is it? - and if it's unassigned and not
NILhow do I know whether or not toFreeit? TheAssignedfunction does not tell me:if Assigned(an_object)is equivalent toif an_object = NIL