How do I implement exceptions with nestable try-catch-finally statement with messages in C

c

Solution

Dave Hanson has already done a really nice package of exception macros as part of his excellent book C Interfaces and Implementations. You could either use the code wholesale or learn from his techniques. For anyone who does a fair amount of C programming, the book is worth buying—it will change the way you change about C programming, and it will show you how to do object-oriented design in C.

Problem

I'm looking to implement exceptions with nestable try-catch-finally statement with messages in C using longjmp/setjmp. I've managed to implement try-catch-else exceptions, they are not nestable. I'm also hoping to add messages to the exceptions. Any idea how I might be able to do it?

Original source