@himitsu
Warum ein
try .. except
wo ein
try .. finally
reicht?
Vor allem im letzten Beispiel lieferst du bei einer
Exception eine ungültige Referenz zurück.
So ist es sauber:
Delphi-Quellcode:
LDataSet := TFDQuery.Create;
try
...
Result := LDataSet;
LDataSet := nil;
finally
LDataSet.Free;
end;
Kaum macht man's richtig - schon funktioniert's

Zertifikat: Sir Rufo (Fingerprint: ea 0a 4c 14 0d b6 3a a4 c1 c5 b9
dc 90 9d f0 e9 de 13 da 60)