runtime error/fi: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | Ajonaikainen virhe (run-time error) on korjaamaton virhetila, joka syntyy [[runtime/fi|ajon aikana]], eli [[Executable program/fi|ohjelman suorituksessa]]. | |
| 2 | 2 | ||
| 3 | 3 | ## Käyttäytyminen | |
| 4 | 4 | ||
| 5 | 5 | [[FPC/fi|FPC]] lisää koodia, havaitsemaan suuren määrän virhetilanteita. Jos tällainen tilanne ilmenee, [[RTL/fi|RTL-kirjasto]] käynnistää ohjelman lopettamisen. Run-time error numero ja sen osoite, jossa virhe tapahtui, tulostetaan. Tämä on turvallisin ja halvin virheenkäsittely. | |
| 6 | 6 | ||
| 7 | 7 | ## Vertailevia huomautuksia | |
| 8 | 8 | ||
| 9 | 9 | ### Käännösajan virheet | |
| 10 | 10 | ||
| 11 | 11 | Toisin kuin [[compile-time error/fi|käännösaikaiset virheet]], jotka [[Compiler/fi|kääntäjä]] havaitsee [[Compile time/fi|kääntämisen aikana]], niin ajonaikaiset virheet riippuvat ohjelman tilasta, joten niitä ei voida ennakoida. Jos syntyy käännösaikainen virhe niin suoritettavaa ohjelmaa ei tule. | |
| 12 | 12 | ||
| 13 | 13 | ### Poikkeukset | |
| 14 | 14 | ||
| 15 | 15 | Ajonaikaiset virheet ovat klassinen välttämätön lähestymistapa, jotta vältetään epäjohdonmukaiset ohjelmatilat, jotka saattavat lopulta aiheuttaa ohjelman viallisen käyttäytymisen. | |
| 16 | 16 | ||
| 17 | 17 | Jos mukana on FPC:n [`sysUtils` unit](https://www.freepascal.org/docs-html/rtl/sysutils/index.html) niin kaikki ajonaikaiset virheet muuttuvat [[Exceptions/fi|poikkeuksiksi]]. (kts. [`system.runTimeErrors`](https://www.freepascal.org/docs-html/rtl/system/runtimeerrors.html) yksityiskohdat). Toisin kuin ajonaikaiset virheet ne jotka voidaan ottaa kiinni [[Try/fi|try]]...[[Except/fi|except]] [[On/fi|on]]...[[Do/fi|do]] ... [[End/fi|end]] [[Block/fi|lohkoilla]] edellyttäen että käytetään poikkeuksia sallivia kääntäjän tiloja kuten[[Mode ObjFPC|{$mode ObjFPC}]] tai [[Mode Delphi|{$mode Delphi}]]. Ajonaikainen virhe saa ohjelman päättymään, kun taas poikkeusten käyttö voi antaa mahdollisuuden korjata ongelma. Standardin mukaisen [`system.runError`](https://www.freepascal.org/docs-html/rtl/system/runerror.html) | |
| 18 | 18 | ||
| 19 | - | ||
| 19 | + | ```text | |
| 20 | + | normaalia käyttäytymistä voidaan muuttaa määrittämällä ei-nil arvo system.errorProc:lle. | |
| 21 | + | ``` | |
| 20 | 22 | ||
| 21 | 23 | ## Katso myös | |
| 22 | 24 | ||
| 23 | 25 | - [Appendix D in the Free Pascal User's Guide: “Run-time errors”](https://www.freepascal.org/docs-html/user/userap4.html) | |
| 24 | 26 | - [[RunError|procedure runError]] | |
| 25 | 27 | - [“Line numbers in run-time error backtraces”](https://www.freepascal.org/docs-html/current/user/userse58.html) in the Free Pascal User's Guide | |
| 26 | 28 | - [`system.returnNilIfGrowHeapFails`](https://www.freepascal.org/docs-html/rtl/system/returnnilifgrowheapfails.html) | |
| 27 | 29 | ||
| 28 | 30 | --- | |
| 29 | 31 | *From the Free Pascal wiki, page "runtime error/fi", 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](/wiki-contact).* |
