_mp_alloc vs ALLOC

Torbjorn Granlund tg at gmplib.org
Mon Jun 4 20:52:32 CEST 2012


  I've seen attempts at structured exception handling in C using
  setjmp/longjmp but they looked awkward and were incomplete, so SEH might
  not be the way to go in C. I don't know what other options may exist.
  
I know of only two C mechanims, either signals+handlers or setjmp+
longjmp.  Using signals is coarse, and will make it hard for user code
to know better what happened.  It might be hard to know it happened in
GMP when a signal comes out-of-the-blue.

Setting up (an array of) setjmp buffers might also be weird.  I don't
know how it interacts with (1) threads or (2) C++.  I suppose threads
will be no problem if done right, but it might be a bit prone to errors.

-- 
Torbjörn


More information about the gmp-devel mailing list