Topic: Exception handling in C
Author: tkolokol@undergrad.math.uwaterloo.ca (Ted Kolokolnikov)
Date: Sun, 30 Jan 1994 20:40:31 GMT Raw View
I would like to implement exception handling in C (using long jumps?)
and I was wondering if anybody has done it already. This exception
handling should be in the style of C++/Ada. Here is an example of how
it can work:
func() {
....
PREPARE_TO_CATCH( BAD1 );
PREPARE_TO_CATCH( BAD2 );
....
doStuff1();
doStuff2();
....
CATCH( BAD1 )
....
END_CATCH( BAD1 );
CATCH( BAD2 )
....
END_CATCH( BAD2 );
....
}
doStuff1() {
....
if (bad_situation1) {
RAISE(BAD1);
}
....
}
doStuff2() {
....
if (bad_situation2) {
RAISE(BAD2);
}
....
}
Please answer by e-mail as I do not read these newsgroups.
If I can make it work and there is enough interest, I will post
the solution.