Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Programming language
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Exception handling=== {{main|Exception handling}} Many programming languages include exception handlers, a section of code triggered by [[runtime error]]s that can deal with them in two main ways:{{sfn|Sebesta|2012|pp=630, 634}} *Termination: shutting down and handing over control to the [[operating system]]. This option is considered the simplest. *Resumption: resuming the program near where the exception occurred. This can trigger a repeat of the exception, unless the exception handler is able to modify values to prevent the exception from reoccurring. Some programming languages support dedicating a block of code to run regardless of whether an exception occurs before the code is reached; this is called finalization.{{sfn|Sebesta|2012|p=635}} There is a tradeoff between increased ability to handle exceptions and reduced performance.{{sfn|Sebesta|2012|p=631}} For example, even though array index errors are common{{sfn|Sebesta|2012|p=261}} C does not check them for performance reasons.{{sfn|Sebesta|2012|p=631}} Although programmers can write code to catch user-defined exceptions, this can clutter a program. Standard libraries in some languages, such as C, use their return values to indicate an exception.{{sfn|Sebesta|2012|p=632}} Some languages and their compilers have the option of turning on and off error handling capability, either temporarily or permanently.{{sfn|Sebesta|2012|pp=631, 635β636}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)