問題1:在C++中,是否可以拋出一個不會被std :: exception捕獲的異常?
是可以拋出一個異常,不會被std :: exception捕獲嗎?
try
{
}
catch(std::exception & e)
{
}
catch(...)
{
//Is this block needed?
}
問題2:
是更好地有:
catch(std::exception & e)
或者
catch(std::exception e)
或者
catch(const std::exception &e)//<--- this is the method I usually use
例如,「throw 1;」是合法的。 – ChrisW 2009-05-25 21:30:37
我愛'扔'Fnugle未找到''的測試代碼。 – peterchen 2009-05-25 21:33:25
你能舉個例子說明爲什麼最好用const來捕捉?一個危險的情況,你趕上了std :: exception e呢? – 2009-05-25 21:35:36