Art*_*rez 3 c++ exception try-catch
gcc(GCC)4.5.3
GNU gdb(GDB)7.5.50.20130309-cvs(cygwin-special)
Netbeans 7.3
我在代码中捕获SIGSEGV,Segment Fault Exception时遇到了一些麻烦.try-catch没有捕获它(下面的代码).这是一个不可捕获的例外吗?有没有办法抓住它?(当然)我做错了什么?
艺术
string SlipStringOp::dump(const SlipCell& X) const {
stringstream pretty;
PTR ptr = *getPtr(X);
pretty << "[string ] " << dumpLink(X) << " = "
<< setfill('0') << setw(8) << hex << ptr
<< " -> ";
try {
pretty << ptr->dump();
} catch(exception& e) {
pretty << e.what();
postError(SlipErr::E3023, "SlipStringOp::dump", "", "Deletion of cell deleted the pointer.");
} catch(...) {
postError(SlipErr::E3023, "SlipStringOp::dump", "", "Deletion of cell deleted the pointer.");
}
return pretty.str();
}; // string SlipStringOp::dump(const SlipCell& X) const
Run Code Online (Sandbox Code Playgroud)