abbiamo un problema divertente con try catch e std :: runtime_error. Qualcuno può spiegarmi perché questo sta restituendo "Errore sconosciuto" come output? Grazie mille per avermi aiutato!Errore nel rilevare std :: runtime_error come std :: exception
#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;
}
Esso stampa "FunnyError" per me, utilizzando Visual C++ 2010. Quale compilatore stai usando? – Doug
Visual Studio 2005 – BlueTrin