blob: 28c7cc7795c90a1307a45c9c4734e549dbbdb475 [file] [log] [blame]
hardlyb1e7e142014-08-06 00:43:51 +03001// open a cmd and execute this: "C:\Program Files (x86)\Microsoft Visual Studio 11.0\vc\vcvarsall.bat" amd64
2// compile with:
3// cl.exe a.cpp /EHs
4// cl.exe a.cpp /EHa
5
6#ifdef _MSC_VER
7//#include <windows.h>
8#endif
9
10#include <iostream>
11using namespace std;
12
13void f(int argc, char** argv) {
14 try {
15 *((char*)666) = 1;
16 } catch(...) {
17 cout << "bad boy!" << endl;
18 }
19
20 try {
21 int out = 5 / (argc - 1);
22 cout << out;
23 } catch(...) {
24 cout << "bad boy!" << endl;
25 }
26}
27
28int main(int argc, char** argv) {
29
30#ifdef _MSC_VER
31 __try {
32#endif
33
34 f(argc, argv);
35
36#ifdef _MSC_VER
37 //} __except(EXCEPTION_EXECUTE_HANDLER) {
38 } __except(1) {
39 cout << "bad MS boy!" << endl;
40 }
41#endif
42
43 return 0;
44}