November 2007
Intermediate to advanced
848 pages
27h 15m
English
Often an exception filter must analyze the situation before it can determine which value to return. For example, your handler might know what to do if a divide by 0 exception occurs, but it might not know how to handle a memory access exception. The exception filter has the responsibility for examining the situation and returning the appropriate value.
This code demonstrates a method for identifying the kind of exception that has occurred:
__try {
x = 0;
y = 4 / x; // y is used later so this statement is not optimized away
...
}
__except ((GetExceptionCode() == EXCEPTION_INT_DIVIDE_BY_ZERO) ?
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
// Handle divide by zero exception.
}The GetExceptionCode intrinsic function returns ...
Read now
Unlock full access