int x = 1000;

void my_unexpected_handler() { throw; }

void foo() throw( int * ) { throw 1000;

}

int main() {

set_unexpected( my_unexpected_handler ); try {

foo();

}

catch(...) {

printf(“fail - not legal in aCC\n”);

}

return 0;

}

Unreachable catch Clauses

Unreachable catch clauses are diagnosed by HP C++ but not by HP aC++. For example,

class C {

//...

};

class D : public C {

//...

};

...

catch(C) {

}

catch(D) { // Unreachable since previous catch masks this one. // Throw of D will be caught by catch for base class.

}

catch(C * ) {

}

catch(D * ) { // Unreachable since previous catch masks this one.

//Throw of D * will be caught by catch for pointer

//to base class.)

}

Throwing an Object having an Ambiguous Base Class

HP C++ generates an object throw error that has an ambiguous base class. In HP aC++, a throw of an object having an ambiguous base class is not caught by a handler for that base, since that would involve a prohibited derived-to-base conversion.

In the following example, the throws are caught by the handlers for D1 and D1*, respectively. The handlers for C are disqualified because C is an ambiguous base class of E:

extern “C” int printf(char*,...);

class C { public: C() {}; };

class D1 : public C { public:

D1() {}; };

Migration Considerations when Using Exception Handling 205