From: Nathan Sidwell <nathan@codesourcery.com>
To: rcuprak@acm.org
Cc: gcc-help@gcc.gnu.org
Subject: Re: Exception Handling
Date: Thu, 16 Jan 2003 17:33:00 -0000 [thread overview]
Message-ID: <3E26EC5A.1040504@codesourcery.com> (raw)
In-Reply-To: <Springmail.0994.1042737289.0.47650900@webmail.pas.earthlink.net>
Ryan Cuprak wrote:
> 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;
> }
this is safe
> 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.
You are confusing the thrown object (a pointer) with the object it points
to (the new'd MyException).
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
next prev parent reply other threads:[~2003-01-16 17:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-16 17:16 Ryan Cuprak
2003-01-16 17:33 ` Nathan Sidwell [this message]
2003-01-16 17:17 Ryan Cuprak
2003-01-17 7:15 ` Michal Lipták
2003-01-17 17:18 ` Oliver Kullmann
2017-05-29 9:00 Exception handling Flis, Przemyslaw (Nokia - PL/Wroclaw)
2017-05-29 9:09 ` Florian Weimer
2017-05-31 8:32 ` Andrew Haley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E26EC5A.1040504@codesourcery.com \
--to=nathan@codesourcery.com \
--cc=gcc-help@gcc.gnu.org \
--cc=rcuprak@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).