Talk:sysutils

From Free Pascal wiki
Revision as of 15:12, 24 January 2021 by Kai Burghardt (talk | contribs) (add reply, insert heading)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

I do not think we should try to "duplicate" the fpc docs here? bart 2016-07-03 17:10 CET.

Exceptions

"To catch an exception by its name you will need to include sysUtils in every unit that may throw an exception"
That makes no sense whatsoever.

unit divzero;

interface

procedure DoDivByZero;

implementation

procedure DoDivByZero;
var
  A, B: Integer;
begin
  A := 1;
  B := 0;
  A := A div B;
end;

end.

This unit does NOT include sysutils.
If you call it from the main program, and your main program uses SysUtils, then you can catch the exception by name: "EDivByZero: Division by zero". --Bart (talk) 13:47, 23 January 2021 (CET)

You’re right. Thank you. Better? Kai Burghardt (talk) 15:12, 24 January 2021 (CET)