[fpc-devel] Patch: Exception handling without SysUtils

Florian Klaempfl florian at freepascal.org
Thu Jul 7 16:03:41 CEST 2005


Yury Sidorov wrote:

> Hello,
> 
> I found that try...except and try...finally do not work if SysUtils unit is
> not used (exception handling code is not called).
> The following patch fixes this issue.

Not using sysutils means that you don't want exceptions. If you want to have run
time errors converted into exceptions use sysutils. The patch has another
probably undesired side effect: imaging someone installed an own errorproc to
release resources (memory etc.) if he did so, he won't get that exception.

> 
> 
> Index: system.inc
> ===================================================================
> --- system.inc (revision 594)
> +++ system.inc (working copy)
> @@ -674,7 +674,10 @@
> Procedure HandleErrorAddrFrame (Errno : longint;addr,frame :
> Pointer);[public,alias:'FPC_BREAK_ERROR'];
> begin
>   If pointer(ErrorProc)<>Nil then
> -    ErrorProc(Errno,addr,frame);
> +    ErrorProc(Errno,addr,frame)
> +  else
> +    if frame <> nil then
> +      raise TObject(nil) at addr,frame;
>   errorcode:=word(Errno);
>   erroraddr:=addr;
>   errorbase:=frame;
> 
> 
> By the way, messages with attachment are not posted to mailing list. Is
> it ok?
> 
> Yury Sidorov, jura at ce.blagovest.com
> 
> 
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel





More information about the fpc-devel mailing list