Re: Try Finally...

From: L D Blake (not_at_any.adr)
Date: 10/25/04


Date: Mon, 25 Oct 2004 08:23:21 -0400

On Mon, 25 Oct 2004 11:23:03 +0100, Duncan McNiven <duncan@mcniven.net> wrote:

>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:

                 Program test;
                var
                        x,y : longint;
                
                procedure doit(z:longint);
                        begin
                                try
                                        y := 100;
                                        x := y div z;
                                finally
                                        writeln('in the finally block now');
                                end;
                        end;

                begin
                        doit(0);
                        writeln('if you''re right you will see this');
                end;

The program will terminate in the finally block and you will never see the
final writeln "if you're right you will see this');

There are two conditions under which finally is entered...

        1) Normally... the code is executed and the program continues.
        2) Exception... the code is executed and the program terminates.

                                                        
-----
Laura

http://www.start.ca/users/ldblake



Relevant Pages

  • Re: remote desktop sessions not terminating?
    ... MS support told me the delay in userinit terminating is caused by 2003 SP1, ... the policy is missing b/c something went wrong with the SP1 install and we ... >>> noticed that after a few minutes userinit.exe terminates. ...
    (microsoft.public.windows.terminal_services)
  • Re: Try Finally...
    ... > I think I am missing your point completely. ... > Finally NEVER terminates the program, and it is ALWAYS possible to carry ... I think she means that the code in the exception block after where the ...
    (comp.lang.pascal.delphi.misc)
  • Re: Try Finally...
    ... >> I think I am missing your point completely. ... >> Finally NEVER terminates the program, and it is ALWAYS possible to carry ... >I think she means that the code in the exception block after where the ...
    (comp.lang.pascal.delphi.misc)
  • Re: Try Finally...
    ... >carrying on. ... I think I am missing your point completely. ... Finally NEVER terminates the program, and it is ALWAYS possible to carry ...
    (comp.lang.pascal.delphi.misc)
  • Re: Threads
    ... bunch of threads and every two seconds I would get a thread print the ... So, what am I missing? ... Also note that if the "main" thread ever terminates then it kills all ...
    (comp.lang.ruby)