try
{
throw SomeException();
}
catch(...) // This syntax
{
std::cout << "An Exception Was Thrown" << std::endl;
}
Exception catch block question
In Visual C++, Microsoft says you can use the following to catch any exception
I don't have access to a non Microsoft compiler at the moment. I get the impression from the MSDN documentation, that catch(...) is Microsoft specific. I just want to confirm this. If it is Microsoft specific, do compilers like gcc have their own method of catching any exception? Or is this universal (which I doubt).
each compiler that ive worked on has supported ellipses (...) in the catch statement, and as a function parameter. So your answer is no, this is not microsoft specific.
from the ISO C++ standard:
Quote:
15.3 - Handling an exception [except.handle]
... snip ...
-6- A ... in a handler's exception-declaration functions similarly to ... in a function parameter declaration; it specifies a match for any exception. If present, a ... handler shall be the last handler for its try block.
... snip ...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement