Sign in Join
Wiki copytemporary

Revision 1 of 1, by Kai Burghardt on 8-6-2022. The page as it is now.

runtime error

A run-time error is an irreparable error condition that arises during the run-time, i.e. the execution of a program.

Behavior

The FPC inserts code to detect a vast number of error situations. If such a situation is encountered, the standard run-time library will initiate the termination of the program. A run-time error number, and the address the error occurred at is being printed. This is the safest and cheapest error treatment.

Comparative remarks

Compile-time errors

In contrast to compile-time errors, which the compiler detects during compilation, run-time errors depend on the state of the program, thus can not be foreseen in advance. If a compile-time error is encountered, no executable program is generated.

Exceptions

Run-time errors are the classical imperative approach in order to avoid inconsistent program states, which may eventually cause faulty program behavior. If FPC's sysUtils unit is included, all run-time errors become exceptions (cf. system.runTimeErrors for details). Unlike run-time errors those can be caught by try...except on...do ... end blocks, provided a mode allowing exceptions – such as {$mode ObjFPC} or {$mode Delphi} – is being used. A run-time error causes the program to terminate, while an exception may give the opportunity to “fix” the problem. This standard behavior of system.runError can be altered by assigning a non-nil value to system.errorProc.

See also


From the Free Pascal wiki, page "runtime error", as it stood on 2022-08-06 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.