Exception handling

Florian Weimer fweimer@redhat.com
Mon May 29 09:09:00 GMT 2017


"Flis, Przemyslaw (Nokia - PL/Wroclaw)" <przemyslaw.flis@nokia.com>
writes:

> as far as I know, the way of handling exceptions "under the hood" is
> not defined in C++ standard. In "Technical report on C++ performance "
> from 2008, I've found two main approaches to exception handling - so
> called "code" and "table" approach. Is there any way to determine
> which is used by gcc compiler? Does it depend on platform (i.e. ARM,
> x86 etc.) or compiler version?

It depends on architecture, compiler version, and how GCC is built for
those architectures which support both approaches.  I think the the
default for the vast majority of architectures is table-based.

> As far I understand "table" approach has almost zero time overhead
> when exception does not appear. But when it does, is this time
> overhead predictable? If it is, how to predict it?

The overhead is not really predictable, except in very special cases.
It can be huge in multi-threaded programs:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71744

Florian



More information about the Gcc-help mailing list