This problem occurs going all the way back to OW 1.2 strangely it does not occur for watcom 10.6
I have tried to stick in all the ex... headers but to no avail. When linked as nt or dos4g(watcom 10.6) no extra header files are required anyway.
Here is a simple program that will demo the aggravation:
Expand|Select|Wrap|Line Numbers
- #include <iostream.h>
- int divide(int divisor, int dividend) throw (const char*)
- {
- if (dividend == 0)
- throw (const char*)"Division by zero attempted";
- // Here we don't have to worry about dividend being zero
- return divisor/dividend;
- }
- int main(void)
- {
- try {
- int result = divide(50,2);
- cout << "divide(" << 50 << ", " << 2
- << ") yields " << result << endl;
- result = divide(50,0);
- cout << "divide(" << 50 << ", " << 0
- << ") yields " << result << endl;
- }
- catch (const char* msg) {
- cout << "Oops, caught: " << msg << endl;
- }
- return 0;
- }