C++ exceptions in VC, without SEH

359 views Asked by At

Is it possible to use VC (Preferably one of the latest versions) and using C++ exceptions, that are not implemented over SEH?

NOTE - I don't mean catching SEH exceptions using C++ catch clause (/Eha \ /Ehsc), I mean using C++ exceptions without having SEH exceptions flying around in the background.

1

There are 1 answers

1
defube On

By default, C++ exceptions are built on top of SEH.

It is possible to change this, but you'd have to re-write a large portion of the runtime, and implement the frame handling logic yourself (read as: lots of assembly).

Due to the dramatic differences between stack frame layouts in 32-bit and 64-bit builds (for x86), you would not be able to re-use very much code between them (64-bit EH also requires digging into another area of the PE image).

That said, unless really really need to, just make sure your code is as portable as possible by using exceptions as you would anywhere else. You can, for the most part, pretend SEH isn't even there.