FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Dobbs M-Dev
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
December 01, 2002

Visual C++ Exception-Handling Instrumentation

(Page 7 of 8)
December 2002/Visual C++ Exception-Handling Instrumentation

Listing 6 Usage of GetCurrentExceptionRecord() (compile with /EHa)


void gpf()
{
    char * p = 0;
    p[6] = 'a';
}

int main()
{
    try
    {
        gpf();
    }
    catch(...)
    {    
        const EXCEPTION_RECORD * pr = GetCurrentExceptionRecord();
        if (pr && pr->ExceptionCode != CPP_EXCEPTION)
        {
            std::cout << "SEH Exception with code " 
                      << std::hex 
                      << pr->ExceptionCode 
                      << std::dec 
                      << " occured at " 
                      << pr->ExceptionAddress 
                      << "\n";
        }
}

    return 0;
}

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK