error handling

Victor Shoup shoup at
Mon Nov 10 16:33:44 UTC 2014

Hi all,

I know that this subject has come up before, but I was wondering if there
are any updates.

I maintain a C++ library (NTL) that uses GMP for long integer arithmetic.
While NTL itself currently has very primitive error handling (print to stderr and abort),
I'm investigating the possibility of making it use exceptions that client code could
potentially deal with.  One obsticle to this is GMP's error handling.
In my particular situation, NTL only uses GMP at the mpn layer, so much of
the memory management is done by NTL (although I presume even the mpn 
layer of GMP needs to allocate memory for temporaries).

So I'm wondering if there is any hope in the future of GMP offering
alternative error handling strategy?  I know that GMP is "pure C",
but perhaps it could nevertheless be updated so that with judicious
use of macros, it could be compiled as a C++ library that would
throw exceptions in an appropriate manner.



More information about the gmp-discuss mailing list