Know some structured exception handling

Source: Internet
Author: User
Tags microsoft c

AnExceptionIs an event that occurs during the execution of a program, and requires the execution of code outside the normal flow of control. There are two kinds of exceptions: hardware exceptions and software exceptions.Hardware exceptionsAre initiated by the CPU. They can result from the execution of certain instruction sequences, such as Division by zero or an attempt to access an invalid memory address.Software exceptionsAre initiated explicitly by applications or the operating system. For example, the system can detect when an invalid parameter value is specified.

Structured Exception HandlingIs a mechanism for handling both hardware and software exceptions. therefore, your code will handle hardware and software exceptions identically. structured exception handling enables you to have complete control over the handling of exceptions, provides support for debuggers, and is usable within SS all programming ages and machines.Vectored Exception HandlingIs an extension to structured exception handling.

The system also supportsTermination handling, Which enables you to ensure that whenever a guarded body of code is executed, a specified block of termination code is also executed. the termination code is executed regardless of how the flow of control leaves the guarded body. for example, a termination handler can guarantee that clean-up tasks are stored med even if an exception or some other error occurs while the guarded body of code is being executed.

The structured exception handling and termination handling mechanisms are integral parts of the system; they enable the system to be robust. You can use these mechanisms to create consistently robust and reliable applications.

Structured exception handling is made available primarily through compiler support. For example, the Microsoft C/C ++ Optimizing Compiler supports_ TryKeyword that identifies a guarded body of code,_ Limit tKeyword that identifies an exception handler, and_ FinallyKeyword that identifies a termination handler.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.