[fpc-pascal] "Continue" not work properly in except clause on win64

Sven Barth pascaldragon at googlemail.com
Fri Aug 28 11:56:17 CEST 2015


Am 28.08.2015 11:08 schrieb "Toru Takubo" <takubo at e-parcel.co.jp>:
>
> Hi all,
>
> I'm trying FPC 3.0.0-rc1 and find "Continue" does not work properly
> in except clause but just jump to finally clause on win64.
>
> Here is a sample code:
> ----------------------------
> program sample;
>
> {$mode objfpc}
>
> uses
>    SysUtils;
> var
>   i: Integer;
> begin
>   try
>     for i:=0 to 2 do begin
>       try
>         Writeln(IntToStr(i));
>         raise Exception.Create('');
>       except
>         Continue;
>       end;
>     end;
>   finally
>     Writeln('done.');
>     Readln;
>   end;
> end.
> ----------------------------
>
> The result on win32:
> ----------------------------
> 0
> 1
> 2
> done.
> ----------------------------
>
> The result on win64
> ----------------------------
> 0
> done.
> ----------------------------
>
> Why such difference? Is this a bug?

It's because since 2.7.1 a different exception handling mechanism is used
on Win64 (and also Win32 if enabled). But yes, it should probably be
considered as a bug, so please file a bug report. As a workaround you could
use a boolean variable that you set inside the handler and evaluate it
afterwards.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150828/091e64a4/attachment.html>


More information about the fpc-pascal mailing list