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

Tomas Hajny XHajT03 at hajny.biz
Thu Dec 10 11:41:53 CET 2020


On 2020-12-10 07:34, Sven Barth via fpc-devel wrote:
> Am 09.12.2020 um 23:45 schrieb Bart via fpc-devel:
>> Compiled with fpc 3.2.0 on Windows it will output (both 32 and 64 
>> bit):
>> Runtime error 201 at $004015F1
>>    $004015F1
>>    $00407307
>> 
>> Compiled with fpc 3.2.0 on linux X86_64 it will output
>> Except block
>> Finally block
>> 
>> On Windows you need to include the sysutils unit to execute the except
>> and finally block.
> 
> 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.
  .
  .

Is the current behaviour on "other" (non-MS Windows) targets really 
correct (I checked under OS/2 for both 3.2.0 and trunk and it behaves 
the same way as Linux)? Including SysUtils should result in converting a 
run-time error to an exception. If SysUtils is not included, run-time 
error should be raised regardless from the try..except block (as it does 
under MS Windows, but not on other platforms at the moment), shouldn't 
it? Shouldn't the try..except construct by default (i.e. without using 
SysUtils) catch only explicitly raised exceptions?

Tomas


More information about the fpc-devel mailing list