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?



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(); }

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.


- FChE


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