Dlaczego ta awaria po złapaniu std :: bad_exception? (Używam VC7)Zawieszenie po wyłapaniu wyjątku
#include "stdafx.h"
#include <exception>
int validateInt (int x) throw (int,std::bad_exception) {
if (0 == x) {
throw std::bad_exception("x");
}
return x;
}
class C {
int i;
public:
C(int);
};
C::C(int ii)
try : i(validateInt(ii)) {
std::cout << "I'm in constructor function body\n";
} catch (std::exception& e) {
std::cout << "I caught an exception...\n";
}
int _tmain(int argc, _TCHAR* argv[]) {
C a(0);
return 0;
}
Jak to się udało skompilować ...? –
Co masz na myśli? Blok try-catch otaczający listę inicjalizacji konstrukcji jest legalny C++. – anonymvs
Wow. Nigdy nie widziałem, żeby był używany, ani nigdy o nim nie słyszałem. –