GMP error handling

Niels Möller nisse at lysator.liu.se
Mon Feb 16 08:51:25 CET 2004


Torbjorn Granlund <tg at swox.com> writes:

> Any error GMP detects would by call the error function.

What kind of errors are you thinking of? Out of memory? Divide by
zero? Invalid arguments? Anything else?

I usually prefer return codes from the failing function, but an error
callback on out-of-memory sounds like it would at least be an
improvement over hacks like longjmp:ing out of the memory allocation
functions.

In order for the error callback to be useful, it must be gmp's
responsibility to do any needed cleanup, so that the program safely
can make other gmp calls after the first error.

Regards,
/Niels


More information about the gmp-devel mailing list