On Wednesday, 18 February 2015 at 09:04:38 UTC, Matthias Bentrup
wrote:
Windows SEH maintains a per-thread linked list of exception
handlers, but the C++ runtime seems to install only one handler
at the start of every function and resorts to lookup tables if
there are multiply try{}s in the function.
If you want to avoid lookup tables, you can of course
add/remove catchers dynamically whenever you enter/leave a try
block, that would add a small cost to every try, but avoids the
(larger) table lookup cost on the catch.
You want to do this as C++ introduce a ton of implicit finally
blocks for destructors. If you would setup one everytime you need
one, you would trash performance in the fast path.