Trups <Samant.Trupti@[EMAIL PROTECTED]
> writes:
> 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.
Here, throw() is an /exception specification/. It means that when you call
IsRebootRequired(), no exceptions will escape into your code. It does
*not*
guarantee that IsRebootRequired won't throw any exceptions though, just
that
if it does, it will terminate the application before you can say
"unhandled
exception".
> If I have this in my code do I need to include "try catch" block? If
> yes why?
You don't need a try/catch block in the code that *calls*
IsRebootRequired,
since no exceptions can escape from it. However, you might want a
try/catch
block *inside* IsRebootRequired if it calls any functions that can
themselves
throw (unless you want your application to terminate in those cases).
Anthony
--
Anthony Williams | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


|