Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: Exception S...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 8 Topic 9569 of 9831
Post > Topic >>

Re: Exception Specifications

by Martin T <0xCDCDCDCD@[EMAIL PROTECTED] > May 2, 2008 at 12:48 PM

Keith Halligan wrote:
> I'm a bit unsure about the following behaviour with exception
> specifiers in C++ functions
> 
> 
> Here's some sample code:
> 
> #include <exception>
> 
> class Sy***ception { };
> 
> void f( ) throw (Sy***ception)
> {
>     throw std::exception();
> }
> 
> 
> int main()
> {
> 
> }
> 

Calling f() should result in std::unexpected being called ...

[http://www.devx.com/tips/Tip/15140]
The Standard Library defines a function called std::unexpected() which
is invoked when a function throws an exception not listed in its
exception specification. std::unexpected invokes a user-defined function
that was registered by std::set_unexpected. If the user hasn't
registered such a function, unexpected() will invoke std::terminate(),
which in turn calls abort() and terminates the program. (...)

Exception specifications are apparently evil:
http://www.gotw.ca/publications/mill22.htm

br,
Martin

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 8 Posts in Topic:
Exception Specifications
Keith Halligan <keith.  2008-05-02 04:43:30 
Re: Exception Specifications
Martin T <0xCDCDCDCD@[  2008-05-02 12:48:22 
Re: Exception Specifications
peter koch larsen <pet  2008-05-02 12:46:50 
Re: Exception Specifications
Francis Glassborow <fr  2008-05-02 12:46:16 
Re: Exception Specifications
Jon <j.trauntvein@[EMA  2008-05-02 12:47:05 
Re: Exception Specifications
gnuyuva <gnuyuva@[EMAI  2008-05-02 12:51:23 
Re: Exception Specifications
Greg Herlihy <greghe@[  2008-05-03 06:13:28 
Re: Exception Specifications
Francis Glassborow <fr  2008-05-03 16:10:23 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:56:06 CDT 2008.