[fpc-pascal] Halt() bypassed try..finally block
memsom at interalpha.co.uk
Thu Sep 13 12:11:32 CEST 2007
Michael Van Canneyt wrote:
> On Thu, 13 Sep 2007, Graeme Geldenhuys wrote:
>> 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:
haltApp := false;
//some code that does something
if (some_condition) then
haltApp := true;
//some other 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.
More information about the fpc-pascal