如果不带参数直接throw;的话,编译可以通过,也没warning,
但debug到throw那一步的话出现类似下面的对话框handling exception that is not defined, Microsoft C++ exception: [rethrow] @ 0x00000000如果随便加个参数如 throw 0;则没事。难道真的一定要参数?
记得看到其他人写的sample的确是没参数的阿。

解决方案 »

  1.   

    应该默认处理所有异常的阿,我是这样的:
    try {
        throw;  // 这里出错
    }
    catch(...) {
        // 处理
    }
      

  2.   

    不带参数直接throw;的话,MSDN里说的是重新抛出被捕获的异常,只能用在catch之后使用。以下是引自MSDN的一段:
    A throw-expression with no operand re-throws the exception currently being handled. Such an expression should appear only in a catch handler or in a function called from within a catch handler. The re-thrown exception object is the original exception object (not a copy). 
    至于为什么不能被catch(...)捕获,我也不清楚,反正就是不能。
      

  3.   

    oh 找到这段了,看来既然ms说了只能在catch里面用,那就是说在try里面用的话出什么事情他们不负责的,
    所以想弹出什么错误都随便他们了,
    vc2003是在程序运行到那里时出来个对话框说runtime error