Hi!

I am currently implementing sequences of bounded integers (which is
useful, e.g., for words over a finite alphabet), and after extensive
benchmarks it seems that using GMP's mpz_t to store the sequence (not
just one item of the sequence) is rather efficient.

But now I wonder: How does GMP handle errors? E.g., what happens if an
allocation by mpz_init2 fails? Does the program then simply crash? Is
there a particular value set on error?

I don't see this addressed in
https://gmplib.org/manual/Initializing-Integers.html, and at
http://stackoverflow.com/questions/19073450/pow-function-and-long-int-causing-problems
I even found it stated that GMP is unsafe, as "it abort()s your
program if any allocation attempt fails".

On the other hand, I see sig_on()/sig_off() around some (but not around
all) potentially failing mpz_* function calls in sage/rings/integer.pyx.
So, is this enough to deal with errors occurring in GMP, or what else?

Best regards,
Simon


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to