Difference between revisions of "Talk:sysutils"

From Free Pascal wiki
Jump to navigationJump to search
(add reply, insert heading)
 
Line 1: Line 1:
 
I do not think we should try to "duplicate" the fpc docs here? [[user:bart|bart]] 2016-07-03 17:10 CET.
 
I do not think we should try to "duplicate" the fpc docs here? [[user:bart|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"<br>
 
"To catch an exception by its name you will need to include sysUtils in every unit that may throw an exception"<br>
 
That makes no sense whatsoever.
 
That makes no sense whatsoever.
Line 26: Line 26:
 
This unit does NOT include sysutils.<br>
 
This unit does NOT include sysutils.<br>
 
If you call it from the main program, <b>and</b> your main program uses SysUtils, then you can catch the exception by name: "EDivByZero:  Division by zero". --[[User:Bart|Bart]] ([[User talk:Bart|talk]]) 13:47, 23 January 2021 (CET)
 
If you call it from the main program, <b>and</b> your main program uses SysUtils, then you can catch the exception by name: "EDivByZero:  Division by zero". --[[User:Bart|Bart]] ([[User talk:Bart|talk]]) 13:47, 23 January 2021 (CET)
 +
: You’re right. Thank you. [[Special: Diff/142578|Better]]? [[User:Kai Burghardt|Kai Burghardt]] ([[User talk:Kai Burghardt|talk]]) 15:12, 24 January 2021 (CET)

Latest revision as of 16:12, 24 January 2021

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)