求教一个c++异常问题

来源:互联网 发布:eve欧服月卡淘宝 编辑:程序博客网 时间:2024/05/20 22:26

#include<iostream>

void foo(char* =0);

int main(){
           foo("hello,");
           try{
                          foo();  
               }
               catch(...){
                          std::cout<<"catched"<<std::endl;
              }
           foo("world!");
           system("pause");
           return 0;
    }
 
void foo(char *pc){
              std::cout<<pc;
     }

上面这段程序在dev-c++中编译通过,但运行结果是
hello,
而且没有捕获到异常。

而在vc6.0中结果却是
hello,catched
world!


高手赐教!!

 

 

原创粉丝点击