Category : Files from Magazines
Archive   : CUJ9209.ZIP
Filename : TEST1.CPP

 
Output of file : TEST1.CPP contained in archive : CUJ9209.ZIP
#include

#include "ExH.h"

class Ex1:public Exception {
int a_value;

public:
Ex1(int v) {a_value = v;}

static int ctype() {return 1;}
int type() {return 1;}
int size() {return sizeof(Ex1);}
int getvalue() {return a_value;}
};

void f2(int fail)
{
if(fail) // Throw
ExH::throw(Ex1(10));

cout << "F2 OK\n";
}

void f1(int fail)
{
f2(fail);
}

main()
{
// Try
if(setjmp(ExH::stk++)==0) {
f1(0);
f1(1);
}
//Catch
else if( ExH::lastEx->type() == Ex1::ctype()) {
Ex1& m = *(Ex1*)ExH::lastEx;
cout << "Catching Exception type 1. Value = "
<< m.getvalue() << "\n";
f1(0);
}
else {
cout << "Bad type\n";
unexpected();
}
cout << "Normal End\n";
}


  3 Responses to “Category : Files from Magazines
Archive   : CUJ9209.ZIP
Filename : TEST1.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/