This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Exception Handling


I think it should be done like this:
throw MyException("method","class","message");

and then catch it:
try {
}
catch(MyException& e) {
}

because the new operator can throw as well.. can't it?
m.

> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On
> Behalf Of Ryan Cuprak
> Sent: Thursday, January 16, 2003 6:15 PM
> To: gcc-help@gcc.gnu.org
> Subject: Exception Handling
> 
> 
> 
> Hello,
>  Is it safe to throw an exception as such:
>  throw new MyException ( "method","class","message);
> 
>  and then catch it as:
>  try {
>  }
>  catch ( MyException *e ) {
>    //-- do something
>    delete e;
>  }
>  I am just looking for some guidelines on exceptions. In doing 
> google searches
> for info, I came across an email stating that the implementation 
> of exceptions
> varies by compiler in that some runtime systems do a binary copy of the
> exception and then pass it to the catch etc.
>  
> Thanks,
>  Ryan
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]