[fpc-devel] Different handling of try..except depending on OS?

Bart bartjunk64 at gmail.com
Thu Dec 10 09:30:36 CET 2020


On Thu, Dec 10, 2020 at 7:34 AM Sven Barth via fpc-devel
<fpc-devel at lists.freepascal.org> wrote:

> That is correct, because without the SysUtils unit (which declared the
> Exception type) the RTL can't convert the triggered runtime error to an
> exception type that can be caught inside the try ... except ... end block.

I would have expected that in that scenario (no sysutils) try..except
or try..finally should raise a compilation error then.
Since you teel the compiler to do things it cannot do?
It would be Delphi incompatible of course ...

B.t.w. (cannot test now, am at work): does it catc exceptions if any
other used unit in the main program uses sysutils?
I.o.w.: is it enough if sysutils gets linked in, or must it be in the
unit/prgram that actually has the try..except/try..finally code in it?

> Behaves like 3.2.0 on what platform? I assume Windows, cause Delphi 10.2
Yes, on Windows.

> It's possibly related to FPC using SEH on Win32 and Win64 instead of the
> SetJump/LongJump based exception handling on other platforms. Slight
> differences are possible and we'd have to investigate why the later does
> not correctly trigger a runtime error.

Ok.
Not a big problem for me (I don't think I have any usefull program
that doesn't include the sysutils unit), it just made me curious.

-- 
Bart


More information about the fpc-devel mailing list