This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Using throw(): to use or not to use?
- From: Joe Buck <jbuck at synopsys dot COM>
- To: fche at redhat dot com (Frank Ch. Eigler)
- Cc: jbuck at synopsys dot COM (Joe Buck), max at e-soft dot ru (Maxim Dementiev),gcc at gcc dot gnu dot org
- Date: Thu, 29 Nov 2001 13:46:13 -0800 (PST)
- Subject: Re: Using throw(): to use or not to use?
>
>
> Joe Buck <jbuck@synopsys.COM> writes:
>
> : [...] Specififying throw() should, if anything, make it possible to
> : generate slightly faster code. If the code is instead slower, I'd
> : call it a bug, [...]
>
> Not really. Within the body of a function declared with throw(), the
> compiler must normally emit *extra* code that asserts that there are
> no exceptions thrown from it, sort of like this:
>
> try { BODY } catch (...) { abort(); }
unless the function is a leaf, or only calls throw() functions.
> The *caller* of such a function may in turn assume that no exceptions
> can come back out, so the compiler may (eventually?) optimize based on
> that. So, specifying throw() allows new optimization opportunities
> only at the caller.
Right.