HRESULT exception not caught in VS 2008

Posted by arionik on Stack Overflow See other posts from Stack Overflow or by arionik
Published on 2010-04-22T14:16:22Z Indexed on 2010/04/22 14:53 UTC
Read the original article Hit count: 191

Hello all, I've got a stange situation in visual studio 2008 C++. I work on code that was originally written for visual studio 2003, where everything works well. Now, ported to VS 2008, the exception handling, which unfortuantely exists widely in the code, does not work anymore. standard code example:

 try
 {
      HRESULT hr = S_OK;
      // do stuff...
      if( FAILED( hr ) ) 
          throw hr;
 }
 catch( HRESULT hr )
 {
      // error handling, but we never get here
 }
 catch( ... )
 {
      // ... not even here
 }

Under VS 2008, no exception is encountered, but I get a crash somewhere else, indicating that the stack pointer must be screwed up. Did anybody come across this behaviour? Any help is appreciated.

© Stack Overflow or respective owner

Related posts about visual-studio-2008

Related posts about c++