Mamy zabawny problem z wypróbowaniem catch i std :: runtime_error. Czy ktoś może mi wyjaśnić, dlaczego powraca "Nieznany błąd" jako wynik? Dziękuję bardzo za pomoc!Błąd z przechwytywaniem std :: runtime_error jako std :: wyjątek
#include "stdafx.h"
#include <iostream>
#include <stdexcept>
int magicCode()
{
throw std::runtime_error("FunnyError");
}
int funnyCatch()
{
try{
magicCode();
} catch (std::exception& e) {
throw e;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
try
{
funnyCatch();
}
catch (std::exception& e)
{
std::cout << e.what();
}
return 0;
}
Drukuje "FunnyError" Dla mnie, przy użyciu Visual C++ 2010. Które kompilatora używasz? – Doug
Visual Studio 2005 – BlueTrin