Note about Visual Studio Compiler Flags - Part 1 (5 flags)

/EHs, /EHc, /EHa, /EHsc (Exception type support)

Project Properties->C++->Code Generation->Enable C++ Exception


  • /EHs: Program supports C++ Standard Exception
  • /EHsc: Program supports C++ Standard Exception, but compiler assumes extern C function never throw the Exception
  • /EHa: Program supports C++ Standard Exception and Microsoft Asynchronized Exception(from hardware)
  • not set the /ET flag: No any exception supports


Use /EHs, if you follow the C++ standard.
Never use /EHa. Check
Disable /EH, if you wanna speed up your program(if you have the evidence that exception is the bottleneck.) According to More Effective C++ Rule15, program which supports Excpetion is 5%~10% slower.

realted post:

/INCREMENTAL (for debug)

Project Properties->Linker->General->Enable Incremental Linking = Yes


compile/link faster


use in debug, set no in release

related warning messages:

warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification
warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification

related post:


Menu->Tools->Options.-> Debugging node->Edit and Continue category


Edit and continue allows you to change code while you are debugging and just keep the program running. It's not supported if the code also has to be optimized.


you put "Edit and continue" on debug builds.

/SAFESEH, (for release)

Project Properties -> Linker folder -> Command Line-> Additional


/SAFESEH generates stack unwinding info in a table rather than using the stack


/SAFESEH makes no sense in the debug build. Only use that linker option in the Release build.

/errorreport (ANY)

Project Properties->Linker->Advanced->PromptImmediately (/ERRORREPORT:PROMPT)


Help Microsoft to collect the internal compiler (Clang.exe) problem/crash/issues.


If you like Microsoft

related post

comments powered by Disqus