exception handling in C
Kari Gran|
grano at cs.Helsinki.FI
Fri Mar 9 10:17:02 AEST 1990
There is a paper titled 'Excaption Handling in C' by Eric. S.
Roberts, published by Digital Equipment Corp., 1989, which describes a
simple exception handling mechanism implemented with preprocessor. The
resulting code looks something like this:
exception OpenError;
TRY
fp = myopen("test.dat", "r");
EXCEPT(OpenError)
printf("Cannot open test.dat\n");
EXCEPT(....)
...
ENDTRY
and in your routines you can use RAISE to raise exceptions. The exceptions
follow a dynamic call chain at runtime. Full source code is included in
the paper; works well, according to my (minor) tests.
Kari.
--
Kari Grano grano at cs.helsinki.fi Hey, my opinions are just mine..
"I've got a thousand telephones that don't ring" - R.Z.
More information about the Comp.lang.c
mailing list