CHAPTER 4 EXCEPTION HANDLING
to transfer control. This capability is particularly important if the block has
accessed resources, such as open files, memory, or synchronization objects,
because the handler can release them. It is also possible to continue program
execution after the exception handler, rather than terminate the program.
ionally, a program can restore system state, such as the floating-point mask,
on exiting from a block. Many examples use handlers in this way.
It is possible to raise an exception at any point during program execution using
function. In this way, your program can detect an error and
treat it as an exception.
is the user-defined code. Do not use bit 28, which is reserved
for the system. The error code is encoded in bits 27–0 (all except the most signifi-
cant hex digit). Bit 29 should be set to indicate a “customer” (not Microsoft) excep-
tion. Bits 31–30 encode the severity as follows, where the resulting lead exception
digit is shown with bit 29 set.
• 0—Success (lead exception code hex digit is 2).
•1—Informational (lead exception code hex digit is 6).
•2—Warning (lead exception code hex digit is A).
• 3—Error (lead exception code hex digit is E).
is normally set to , but setting the value to
indicates that the filter expression should not
; doing so will cause an immediate
, if not , points to an array of size (the third
parameter) containing 32-bit values to be passed to the filter expression. There is