<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Bart via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> schrieb am Do., 10. Dez. 2020, 11:56:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Dec 10, 2020 at 7:34 AM Sven Barth via fpc-devel<br>
<<a href="mailto:fpc-devel@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-devel@lists.freepascal.org</a>> wrote:<br>
<br>
> That is correct, because without the SysUtils unit (which declared the<br>
> Exception type) the RTL can't convert the triggered runtime error to an<br>
> exception type that can be caught inside the try ... except ... end block.<br>
<br>
I would have expected that in that scenario (no sysutils) try..except<br>
or try..finally should raise a compilation error then.<br>
Since you teel the compiler to do things it cannot do?<br>
It would be Delphi incompatible of course ...<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">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. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
B.t.w. (cannot test now, am at work): does it catc exceptions if any<br>
other used unit in the main program uses sysutils?<br>
I.o.w.: is it enough if sysutils gets linked in, or must it be in the<br>
unit/prgram that actually has the try..except/try..finally code in it?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">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. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div></div>