Shortened version in C Users Journal, Oct. 1993, vol. 11, no. 10, pp. 33-46.
We present a set of macros which supports exception handling in ANSI C. Source codenadang theseCVAP/ macros needs no special pre-processing; the usual C pre-processor pass will suffice.
Exceptions can be defined, thrown and caught with a uniform block-oriented syntax. Top-level handlers can be installed for exceptions that would otherwise not be caught. The package also includes a callback facility which can restore user-defined data structures when exceptions are thrown.
Two application examples are presented: an error message handler and a scheme for translating signals into exceptions.
Keywords: C, exception, unwind, signal