Exception Safe Programming

Saaa empty at needmail.com
Mon Feb 26 03:57:09 PST 2007


Okay, thanks.


>> How do I read the exceptions thrown in the main > scope(failure) ?
>> Or should I just put everything in a try-catch ?
>>
>>
> You can't handle any exceptions outside of try-catch-finally blocks.  The 
> scope guards exist to ensure that any cleanup necessary (such as closing 
> network connections or releasing mutexes in multithreaded programs) gets 
> performed before all references to the associated resources are lost.  To 
> actually access the exceptions the exception needs to be thrown in the 
> scope of a try block (somewhere, it doesn't need to be the immediate 
> function) and that try block must have a catch and/or finally block. 




More information about the Digitalmars-d-learn mailing list