A
Adam
I was looking for a way to just catch any exception throw. Given the
postings, it looks like catch(...) should do it, except it doesn't.
Maybe C++ is suppose to work this way, or maybe this is a bug in g++.
I have a small program to demonstrate below. I compiled on a RH9
system using g++ v3.4.5.
#include <iostream>
main()
{
try {
throw(1);
} catch (...) {
std::cerr << "Caught integer exception\n";
}
try {
throw;
} catch (...) {
std::cerr << "Caught exception\n";
}
}
The first exception is caught when an integer is thrown. The second
one isn't caught.
I just need to capture an exception because of a possible error in a
constructor (so I can't pass back an error code). I don't need to send
any information in the exception, so I was just using throw without any
arguments. Looks like I'll need to send something just so it works
unless I'm doing something wrong.
postings, it looks like catch(...) should do it, except it doesn't.
Maybe C++ is suppose to work this way, or maybe this is a bug in g++.
I have a small program to demonstrate below. I compiled on a RH9
system using g++ v3.4.5.
#include <iostream>
main()
{
try {
throw(1);
} catch (...) {
std::cerr << "Caught integer exception\n";
}
try {
throw;
} catch (...) {
std::cerr << "Caught exception\n";
}
}
The first exception is caught when an integer is thrown. The second
one isn't caught.
I just need to capture an exception because of a possible error in a
constructor (so I can't pass back an error code). I don't need to send
any information in the exception, so I was just using throw without any
arguments. Looks like I'll need to send something just so it works
unless I'm doing something wrong.