在以下c++程序中,set_unexpected(my_unexpected);语句为何没起作用?
我是在vc++中编译运行的:
#include <exception>
#include <stdexcept>
class one { };
void g(){ throw 47;}
void func(int i){ switch(i){case 1:throw one();} g();}
void my_unexpected(){ }
void main(){
set_unexpected(my_unexpected);
for (int j=1;j<3;j++)
try{ func(j);}
catch(one) {}}
在调试中,当j=2运行到g()抛出异常47时,接下来并没有运行my_unexpected()函数,而是由vc给出"unhandled exception :in vc++ Exception.",请问是为什么?