Jump to content
  • Advertisement
Sign in to follow this  
Rattrap

Exception catch block question

This topic is 4728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In Visual C++, Microsoft says you can use the following to catch any exception
try
{
    throw SomeException();
}
catch(...) // This syntax
{
    std::cout << "An Exception Was Thrown" << std::endl;
}

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).

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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 ...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!