6

I am rolling my own exception library for C and would like good examples to examine.

So far, I have been looking at David Hanson's: http://drhanson.net/work/

But I know I've seen other ones available in the past. Can you send me some additional pointers?

Thanks,

SetJmp

Setjmp
  • 27,279
  • 27
  • 74
  • 92

4 Answers4

3

Here is one, compatible with C89 and implementing the try/catch/finally schema as can be found in other OO languages.

philant
  • 34,748
  • 11
  • 69
  • 112
1

Symbian implemented exceptions (called 'leaves') in terms of longjmp. This was C++ code, but translatable to C. There's a previous post about this.

Community
  • 1
  • 1
Will
  • 73,905
  • 40
  • 169
  • 246
0

Take a look at XXL: http://www.zork.org/xxl/

I found it quite usable in a previous project. Hasn't been updated in a while though.

Jason
  • 2,233
  • 3
  • 24
  • 27
0

CException is simple exception handling in C. It is significantly faster than full-blown C++ exception handling but loses some flexibility. It is portable to any platform supporting setjmp/longjmp.

philant
  • 34,748
  • 11
  • 69
  • 112