Appendix B. The SysUtils Unit
The SysUtils unit contains many utility classes,
types, variables, and subroutines. They are so central to Delphi
programming that many Delphi users forget that the
SysUtils unit is not built in and is optional.
Because it is not built into the Delphi Pascal language, the
SysUtils unit is not covered in this book’s
main text. On the other hand, it plays such a central role in almost
every Delphi program, package, and library, omitting it would be a
mistake—hence this appendix.
Errors and Exceptions
This section lists the classes and subroutines to help you handle
errors and exceptions. The most important role
SysUtils plays is assigning values to the
error-handling procedure pointers the System unit
declares, namely:
AbstractErrorProcraises anEAbstractErrorexception.AssertErrorProcraises anEAssertionFailedexception.ErrorProcmaps runtime errors to exceptions.ExceptClsProcmaps Windows and hardware exceptions to Delphi exception classes.ExceptionClassis set toException.ExceptObjProcmaps Windows and hardware exceptions to Delphi exception objects.ExceptProcdisplays exception information and callsHalt.
If an error or exception occurs before the
SysUtils unit is initialized or after it is
finalized, you don’t get the advantage of its error-handling
procedures, and must rely on the simple approach of the
System unit. This problem occurs most often when an application shuts down: an application corrupts memory by freeing already-freed memory, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access