runtime error/fi: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: runtime error/fi
| Old | New | Line | |
|---|---|---|---|
| 1 | + | Ajonaikainen virhe (run-time error) on korjaamaton virhetila, joka syntyy [[runtime/fi|ajon aikana]], eli [[Executable program/fi|ohjelman suorituksessa]]. | |
| 2 | + | ||
| 3 | + | ## Käyttäytyminen | |
| 4 | + | ||
| 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 | + | ||
| 7 | + | ## Vertailevia huomautuksia | |
| 8 | + | ||
| 9 | + | ### Käännösajan virheet | |
| 10 | + | ||
| 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 | + | ||
| 13 | + | ### Poikkeukset | |
| 14 | + | ||
| 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 | + | ||
| 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 | + | ||
| 19 | + | `normaalia käyttäytymistä voidaan muuttaa määrittämällä ei-`[[Nil/fi|nil]]` arvo `[`system.errorProc`](https://www.freepascal.org/docs-html/rtl/system/errorproc.html)`:lle.` | |
| 20 | + | ||
| 21 | + | ## Katso myös | |
| 22 | + | ||
| 23 | + | - [Appendix D in the Free Pascal User's Guide: “Run-time errors”](https://www.freepascal.org/docs-html/user/userap4.html) | |
| 24 | + | - [[RunError|procedure runError]] | |
| 25 | + | - [“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 | + | - [`system.returnNilIfGrowHeapFails`](https://www.freepascal.org/docs-html/rtl/system/returnnilifgrowheapfails.html) | |
| 27 | + | ||
| 28 | + | --- | |
| 29 | + | *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).* |
