c++11 noexcept修饰符
c++11 noexcept修饰符
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <string> #include <vector> #include <map> void fun3() throw(int, char) // 只能够抛出 int 和char类型的异常 { //C++11已经弃用这个声明 throw 0; } void BlockThrow() throw() //代表此函数不能抛出异常,如果抛出,就会异常 { throw 1; } //代表此函数不能抛出异常,如果抛出,就会异常 //C++11 使用noexcept替代throw() void BlockThrowPro() noexcept { throw 2; } void mytest() { return; } int main() { mytest(); system("pause"); return 0; }