I get a bad exit code on closure, but the catch-block didnt get executed on me or do i have to code myself the throwing of an exception?
im using gcc version 4.3.2 on mingw/msys
#include <iostream>
#include <stdexcept>
#include <vector>
using std::vector;
using std::cout;
using std::cerr;
using std::endl;
using std::out_of_range;
int main()
{
vector<int> intVec;
try {
int integer = intVec[-1];
cout << "This won't get executed :)" << endl;
}
catch(out_of_range &e)
{
cout << "This won't get executed too :( on my machine" << endl;
cerr << e.what() << endl;
}
catch(...)
{
cerr << "unhandled exception" << endl;
}
}