What is the difference between MinGW SEH and MinGW SJLJ?

vasili111 picture vasili111 · Jun 9, 2015 · Viewed 19.8k times · Source

I am just starting to learn C and installing now QT x64 (form here: http://tver-soft.org/qt64). I have two options to install: MinGW 4.9.2 SEH or MinGW 4.9.2 SJLJ.
Question: Which is better to install and why?

I read What is difference between sjlj vs dwarf vs seh? and https://wiki.qt.io/MinGW-64-bit#Exception_handling:_SJLJ.2C_DWARF.2C_and_SEH but understand nothing (new to C and compiller languages).

Answer

Apples picture Apples · Jun 9, 2015

SJLJ and SEH are two different exception handling systems.

For the specific differences, the resources you've already seen cover everything.

However, as for which one is better to install, go with SJLJ unless you know that you need SEH.

2019 Update: On modern systems, there's no reason to use SJLJ, so the advice above should probably be flipped. SEH is more common now. Ultimately though, it doesn't really matter, since it's easy to switch between the two.

SJLJ

SJLJ is more widely supported across architectures, and is more robust. Also, SJLJ exceptions can be thrown through libraries that use other exception handling systems, including C libraries. However, it has a performance penalty.

SEH

SEH is much more efficient (no performance penalty), but unfortunately is not well-supported. SEH exceptions will cause bad things to happen when thrown through libraries that do not also use SEH.

As far as your code is concerned, there are no real differences. You can always switch compilers later if you need to.