This is the mail archive of the gcc@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: Using throw(): to use or not to use?


> 
> On Nov 29, 2001, Joe Buck <jbuck@synopsys.COM> wrote:
> 
> > Specififying throw() should, if anything, make it possible to generate
> > slightly faster code.
> 
> Unless you're talking about the function marked as throw() itself,
> with an EH model such as setjmp().  This would require the function to
> set up handlers that would call unexpected() should the function throw
> or propagate some inappropriate exception.

Such handlers are only necessary if the function marked as throw() calls
some other function that is not marked as throw(), or operator new.
But yes, you're correct in that there can be a cost for setting up
this handler.  However, for the case of the function itself throwing
there need be no overhead for the cases where these throws are not
reached, so it is only the propagation of exceptions from other calls
that is a cost.


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