Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-06

why isn't the 'exit' in the finally end clause executed?

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dennis

Using fpc 3.0.4, Lazarus 2.0, the following simple program

program tryfinally;
begin
   try
     Writeln('before finally');
   finally
      Writeln('inside finally. Before Exit');
      exit; //<----why isn't it executed?
   end;
   Writeln('after try finally block');
end.

gives

P:\RAM64>tryfinally.exe
before finally
inside finally. Before Exit
after try finally block

I have tried putting the try finally block inside a procedure, the same happened.
program tryfinally;

procedure Test;
begin
     try
       Writeln('before finally');
     finally
        Writeln('inside finally. Before Exit');
        exit;
     end;
     Writeln('after try finally block');
end;
begin
   Test;
end.

Dennis

Jonas Maebe
to Dennis
Dennis wrote 14 lines
Using fpc 3.0.4, Lazarus 2.0, the following simple program program tryfinally; begin   try     Writeln('before finally');   finally      Writeln('inside finally. Before Exit');      exit; //<----why isn't it executed?   end;   Writeln('after try finally block'); end.

I seem to remember this was a bug in the Win64 SEH support that was fixed later on, but I can't find the bug report.

Jonas

Sven Barth
to Jonas Maebe: I seem to remember this was a bug in the Win64 SEH support that was fixed later on, but I…
Jonas Maebe wrote 17 lines
On 23/06/2019 09:08, Dennis wrote: > Using fpc 3.0.4, Lazarus 2.0, the following simple program > > program tryfinally; > > begin >   try >     Writeln('before finally'); >   finally >      Writeln('inside finally. Before Exit'); >      exit; //<----why isn't it executed? >   end; >   Writeln('after try finally block'); > > end. I seem to remember this was a bug in the Win64 SEH support that was fixed later on, but I can't find the bug report.

It's still the case on current trunk at least on Win64.

Regards,
Sven

Dennis
to Sven Barth

.

> I seem to remember this was a bug in the Win64 SEH support that was > fixed later on, but I can't find the bug report. It's still the case on current trunk at least on Win64.

Since it might be a bug, I'd like to search for all occurrences of such combination in my projects.
How do I find it using regular expression ACROSS line breaks? That is, how to find the following in Lazarus IDE?

finally
    .....
    exit;
    .....
end;

Thanks in advance.

Dennis