官方介绍地址
http://msdn.microsoft.com/en-us/library/1deeycx5(v=vs.80).aspx
参数说明
a
The exception-handling model that catches asynchronous(structured) and synchronous (C++) exceptions.
s
The exception-handling model that catchesC++ exceptions only and tells the compiler to assume that extern C functions do throw an exception.
c
If used with s (/EHsc), catches C++ exceptionsonly and tells the compiler to assume that extern C functions never throw a C++ exception. /EHca is equivalent to /EHa.
官方说明如下:
Use /EHs to specify the synchronous exceptionhandling model (C++ exception handling without structured exception handlingexceptions). If you use /EHs,then your catch clause will not catch asynchronous exceptions. Also, in VisualC++ 2005, all objects in scope when the asynchronous exception is generatedwill not be destroyed even if the asynchronous exception is handled. Under /EHs, catch(...) will only catch C++ exceptions. Accessviolations and System.Exception exceptionswill not be caught.
Use /EHa to specify the asynchronous exceptionhandling model (C++ exception handling with structured exception handlingexceptions). /EHa may result in a less performant imagebecause the compiler will not optimize a catch block as aggressively, even ifthe compiler does not see a throw.
Use /EHa if you want to catch an exceptionraised with something other than a throw. The following sample will generate anexception:
// compiler_options_EHA.cpp // compile with: /EHa #include <iostream> #include <excpt.h> using namespace std; void fail() { // generates SE and attempts to catch it using catch(...) try { int i = 0, j = 1; j /= i; // This will throw a SE (divide by zero). } catch(...) { // catch block will only be executed under /EHa cout<<"Caught an exception in catch(...)."<<endl; } } int main() { __try { fail(); } // __except will only catch an exception here __except(EXCEPTION_EXECUTE_HANDLER) { // if the exception was not caught by the catch(...) inside fail() cout << "An exception was caught in __except." << endl; } }
The /EHc option requires that /EHs or /EHa is specified. Using /clr (CommonLanguage Runtime Compilation) implies /EHa (/clr /EHa is redundant). The compiler willgenerate an error if/EHs[c] isused after /clr.Optimizations will not affect this behavior. When an exception is caught, thecompiler invokes the class destructor or destructors for the object or objectsthat are in the same scope as the exception. When an exception is not caught,those destructors are not run.
See _set_se_translator forexception handling restrictions under /clr.
The option can be cleared by the symbol -. For example, /EHsc- is interpreted as /EHs /EHc- and is equivalent to /EHs.
See Exception Handling: Default Synchronous Exception Model for more information.
To set this compiler option in the Visual Studio developmentenvironment
1. Open the project's Property Pages dialog box. For details, see How to: OpenProject Property Pages.
2. Click the C/C++ folder.
3. Click the Code Generation property page.
4. Modify the Enable C++ Exceptions property.
Alternately, you can use the following procedure:
To set this compiler option in the Visual Studio developmentenvironment
1. Click the C/C++ folder.
2. Click the Code Generation property page.
3. Set Enable C++ Exceptions to No.
4. Click the Command Line property page.
5. Type the compiler option inthe Additional Options box.
To set this compiler option programmatically
· See ExceptionHandling.
相关推荐
详细介绍VC编译开关/EHsc /EHa /EHc
XP系统在使用搜索时出现意外错误情况。EXPLORER没问题,可以运行资源中的两个文件解决问题。
C99•单一来源•与平台无关•类似XNA•感知分配器•游戏开发库•从很棒的... # -c compiles the code as a library# -EHsc disables exceptions on msvcgcc -c rayfork.cclang -c rayfork.ccl -c -EHsc rayfork.c原则
LuaBridge 3.1 是一个轻量级且无依赖的库,用于在C ++和 (一种强大,快速,轻量级,可嵌入的脚本语言)之间来回... 可以使用c ++异常,也可以不使用c ++异常(与-fno-exceptions和/EHsc- )。 以清晰且易于调试的
要在Windows上编译(需要 ): cl /EHsc 8hex.cpp 在Linux上编译: g++ 8hex.cpp -o8hex ##示例用法: 8hex | oclHashcat64 -m 2500 CAP.hccap 8hex | oclHashcat64 -m 2500 CAP.hccap 将其输出通过管道到 (AMD...
Vim电源模式 Vimmers的电源模式 它是如何工作的 用法 :PowerModeOn :PowerModeOff 去做 将在Linux / Unix上工作 安装 克隆项目 ... 在C:/ Windows中制作cl.bat(将12.0更改为VS版本)...cl -EHsc -Feparticle particle.cp
主要内容:1.MFC对话框中编辑框字体大小与颜色的设置;2.List control控件的使用实例代码;3.VS2005编写。
二进制求补运算符:~ 语法 ...访问程序中的 compl 运算符有两种方式:包括头文件 iso646.h,或使用 /Za 进行编译。 // expre_One_Complement_Operator.cpp // compile with: /EHsc #include <io
/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /EHsc /RTC1 /MLd /YX"stdafx.h" /Fp".\Debug/topSort.pch" /Fo".\Debug/" /Fd".\Debug/" /W3 /c /ZI /TP .\topSort.cpp ] 正在创建命令行“cl.exe @f:\第...
Windows运行时研讨会 介绍Windows运行时技术 如何在标准C ++中构建Windows运行时 Visual Studio编译/链接命令: cl sample.cpp / Zc:wchar_t / EHsc / Gm / W4 / D“ _UNICODE” / D“ UNICODE”
// compile with: /EHsc #include using namespace std; int main() { int a = 2, b = 4, c = 9; cout << a + b * c << \n; cout << a + (b * c) << \n; cout << (a + b) * c &...
虚函数 虚函数是应在派生类中重新定义的成员函数。 当使用指针或对基类的引用来引用派生的类对象时,可以为该对象调用虚函数并执行该函数的派生类版本。...// compile with: /EHsc #include <iostream>
cerrThe object controls unbuffered insertions to the standard error output as a byte stream. Once the object is nstructed, the expression cerr.flags & unitbuf is nonzero. Example // iostream_...