catch(…) vs catch(CException *)?

转自:https://stackoverflow.com/questions/7412185/what-is-the-difference-between-catch-vs-catchcexception

try
{
}
catch( const CException & e )
{
// catch all CExceptions
// as far as I know it is ok now to catch CException by reference with modern Microsoft compilers? It was not always the recommended microsoft way

//catch(CException) will catch only thrown instances of CException and its subclasses
}
catch( const std::exception & e )
{
// catch standard C++ exception,you can use e.what() to know what exception you caught


}
catch( ... )
{
// catch others
}

posted on 2018-05-22 10:23  我来乔23  阅读(335)  评论(0编辑  收藏  举报

导航