Re: Try Finally...
From: Duncan McNiven (duncan_at_mcniven.net)
Date: 10/25/04
- Next message: Bjørge Sæther: "LPT port, anyone ?"
- Previous message: matt parker: "Re: spam the child molester matt parker off the web"
- In reply to:(deleted message) L D Blake: "Re: Try Finally..."
- Next in thread: Marco van de Voort: "Re: Try Finally..."
- Reply: Marco van de Voort: "Re: Try Finally..."
- Reply:(deleted message) L D Blake: "Re: Try Finally..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 25 Oct 2004 11:23:03 +0100
On Mon, 25 Oct 2004 04:37:22 -0400, L D Blake <not@any.adr> wrote:
>The problem is that **when invoked by an exception** the current Delphi
>implementation of "Finally" *always* terminates the program... there is no
>carrying on.
I think I am missing your point completely. My understanding is that
Finally NEVER terminates the program, and it is ALWAYS possible to carry
on. For example:
procedure TForm1.Button1Click(Sender: TObject);
var
x,y,z : real;
begin
try
x := SpinEdit1.Value;
y := SpinEdit2.Value;
try
z:= x/y; // Set SpinEdit2 to 0 to cause exception here
finally
Label1.Caption := Format('%f',[z]);
end;
except
on EZeroDivide do
begin
Caption := 'Finally did NOT terminate program - it carried on';
Label1.Caption := 'Error! Cannot divide by zero!!';
end;
end;
end;
Can you post a counter-example where Finally DOES terminate the program?
-- Duncan
- Next message: Bjørge Sæther: "LPT port, anyone ?"
- Previous message: matt parker: "Re: spam the child molester matt parker off the web"
- In reply to:(deleted message) L D Blake: "Re: Try Finally..."
- Next in thread: Marco van de Voort: "Re: Try Finally..."
- Reply: Marco van de Voort: "Re: Try Finally..."
- Reply:(deleted message) L D Blake: "Re: Try Finally..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]