This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Exception Handling
- From: Michal Lipták <liptak at isdd dot sk>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Fri, 17 Jan 2003 08:16:44 +0100
- Subject: 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
>