Bart via fpc-devel <fpc-devel@lists.freepascal.org> schrieb am Do., 10.
Dez. 2020, 11:56:

> On Thu, Dec 10, 2020 at 7:34 AM Sven Barth via fpc-devel
> <fpc-devel@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 ...
>

The *compiler* handles it correctly. It's the *RTL* that's not setup in a
way that it would work correctly in that case. And since in theory the user
is completely free to provide their own RTL the compiler can't do any
checks here.


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

The initialization section of the SysUtils unit needs to be executed, so as
long as any other unit includes the SysUtils unit it will work.

Regards,
Sven
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to