Alister wrote:
> Exceptions can be generated in constructors as well.
> so
> try
>   x := Tobj.Create;  //an exception could occur here
> finally
>   x.free;//this is now a programming error
> end;

Correct. This exception handling code is ill-formed.
Either add x := nil before the try or move the Create outside the try.

A static tool which check for ill-formed code like this might be usefull.
Exception handling is a tad subtle and seems to often trip people up.

I wonder if that Pascal Analyser thing I saw references does that kind of
checking?

TTFN,
  Paul.



_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to