The segmentation error at execution of code while throwing exception...

This is an actual working code with segmentation error (Core). It dumps core while throwing exception from my_print function. I was wondering this is the best way to do this...

#include <stdio.h>

#include <iostream.h>

#include <stdexcept>

#define PD_BEGIN_DESTRUCTOR \

bool unwinding = std::uncaught_exception(); \

try \

{

#define PD_END_DESTRUCTOR\

}\

catch(...)\

{\

if (!unwinding )\

throw; \

}

class e : public std::exception

{

public:

e(){

cout<<"Exception from class e without error"<<endl;

}

};

class myclass{

public:

myclass(){

cout><<"This class is to test destrcutors"<<endl;

}

~myclass(){

PD_BEGIN_DESTRUCTOR

cout><<"This class is to test destructor - at destructor"<<endl;

PD_END_DESTRUCTOR

}

void my_print(){

cout><<"This print the statement before exception"<<endl;

e exp;

throw exp;

}

};

int main()

{

myclass* my=new myclass;

my->my_print();

return 0;

}

[1211 byte] By [Sara_Kan] at [2007-11-26 9:22:20]
# 1
The program aborts because function my_print throws an exception that is never caught.You'll have to explain what you are trying to do before I could say whether it is a good idea.First off, however, I would say the using macros to obscure control flow is a Bad Idea.
clamage45 at 2007-7-6 23:55:34 > top of Java-index,Development Tools,Solaris and Linux Development Tools...