I've written a small exception demo in C and tried to avoid macros as far as possible.
> C code *may*, if it chooses, install a generic exception override, > and we'll have a routine for this. Something like: > > EXCEPTION_OVERRIDE(&exception_frame); > EXCEPTION_RELEASE(&exception_frame); This is implemented this way: ex_scope ex; ex_scope_begin( ex ); if( !ex_occured( ex ) ) { printf( "throwing exception 123...\n" ); ex_throw( 123 ); printf( "error\n" ); } else { printf( "fetched exception #%d\n", ex_type() ); } ex_scope_end( ex ); It uses only a single macro "ex_scope_begin" (which calls setjmp). The code has been tested with gcc2.96 and 3.0.4 on RH Linux, gcc 2.95.1 on Solaris and MS VC 6 on Windows 2000 (I think, do not use windows myself). The sourcecode is available here: http://jbs.t0c.de/parrot/ In exception.h is a "struct ex_info_t", which at the moment just contains a field "type"; "Language", "Class", "Object" etc can be added there easily.