Michael Van Canneyt wrote:
On Thu, 13 Sep 2007, Graeme Geldenhuys wrote:

Hi,

Is that correct behavior?  When calling Halt() somewhere inside a
try..finally block, it _doesn't_ execute the finally code.

This is by design.

Halt finalizes the units and then exits.
Yeah, I always used to use something like:

var
 haltApp: boolean;
begin

haltApp := false;

try
 //some code that does something
 if (some_condition) then
 begin
   haltApp := true;
   exit;
 end;
 //some other code
finally
 //cleanup code

if (haltApp) then Halt(halt_condition_code); // one could argue this should be outside of the finally, // but if it were it would not always be executed as // desired - especially if an exception was raised. end;
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to