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: throw()
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 4 Topic 9560 of 9828
Post > Topic >>

Re: throw()

by ThosRTanner <ttanner2@[EMAIL PROTECTED] > Apr 29, 2008 at 12:13 PM

On Apr 29, 5:43 pm, Trups <Samant.Tru...@[EMAIL PROTECTED]
> wrote:
> Hi,
>
>   bool CControlDrvInstance::IsRebootRequired() const throw()
> In this code what is throw() do?  I just have slight knowledge that is
> a exception handler but how does it work.
It's not an exception handler, it's an exception specification. It
guarantees that control will never leave the method via an exception.
It will either leave by normal return, or, if someone has thrown an
exception inside the implementation, then the program will be
terminated with extreme prejudice.

> If I have this in my code do I need to include "try catch" block?  If
> yes why?
Well, you may well need it if you are implementing this function,
otherwise any exceptions thrown inside the function will cause a nasty
case of death. Callers of the function are guaranteed there won't be
any exceptions to be caught (though not necessarily in a nice way).

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




 4 Posts in Topic:
throw()
Trups <Samant.Trupti@[  2008-04-29 10:43:21 
Re: throw()
Michael Aaron Safyan <  2008-04-29 12:13:39 
Re: throw()
ThosRTanner <ttanner2@  2008-04-29 12:13:38 
Re: throw()
Anthony Williams <anth  2008-04-29 12:43:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Thu Jul 24 16:00:09 CDT 2008.