Difference between revisions of "sysutils"
(→Caveats: cf. discussion) |
(→Caveats: use more generic term “module” [referring to either unit or program source code file]) |
||
Line 16: | Line 16: | ||
== Caveats == | == Caveats == | ||
{{Doc|package=RTL|unit=system|identifier=runtimeerrors|text=If the <syntaxhighlight lang="pascal" inline>sysUtils</syntaxhighlight> unit is included}}, all [[runtime error|run-time errors]] become [[Exceptions|exceptions]], which virtually forces you to use a [[Compiler Mode|compiler mode]] (or [[modeswitch|mode switch]]) that allows exception treatment. | {{Doc|package=RTL|unit=system|identifier=runtimeerrors|text=If the <syntaxhighlight lang="pascal" inline>sysUtils</syntaxhighlight> unit is included}}, all [[runtime error|run-time errors]] become [[Exceptions|exceptions]], which virtually forces you to use a [[Compiler Mode|compiler mode]] (or [[modeswitch|mode switch]]) that allows exception treatment. | ||
− | To catch an exception by its name you will need to include <syntaxhighlight lang="pascal" inline>sysUtils</syntaxhighlight>, even though the | + | To catch an exception by its name you will need to include <syntaxhighlight lang="pascal" inline>sysUtils</syntaxhighlight>, even though the module itself does not use any of the included system utilities. |
If [[Size Matters|size matters]], using <syntaxhighlight lang="pascal" inline>sysUtils</syntaxhighlight> is by design not the smartest choice. | If [[Size Matters|size matters]], using <syntaxhighlight lang="pascal" inline>sysUtils</syntaxhighlight> is by design not the smartest choice. |
Revision as of 16:14, 24 January 2021
│
English (en) │
Esperanto (eo) │
français (fr) │
The unit sysUtils
shipped with the FPC’s default run-time library provides many system utilities.
It attempts to be as compatible to Delphi’s sysUtils
unit as possible.
However, the FPC version is available on all platforms that the FPC supports.
It does not contain any Windows-related routines or other highly platform-specific functionality.
Notable functionality
format
executeProcess
for executing external programs- several routines ensuring productive use of
tDateTime
- type helpers for all basic data types
freeAndNil
- routines to access environment variables
Caveats
If the sysUtils
unit is included, all run-time errors become exceptions, which virtually forces you to use a compiler mode (or mode switch) that allows exception treatment.
To catch an exception by its name you will need to include sysUtils
, even though the module itself does not use any of the included system utilities.
If size matters, using sysUtils
is by design not the smartest choice.