gmpxx.h constructor exceptions

Roberto Bagnara bagnara at
Sat Oct 18 01:10:24 CEST 2003

Kevin Ryde wrote:
> When the mpz_class(string) constructor or operator= finds its string
> is not a valid number, I'm thinking to have it throw
> std::invalid_argument.  This is the same as what std::bitset does, if
> I read it right.  Does that sound sensible to C++ experts lurking
> here?

This makes sense to me.

> And for the gmp_randclass constructor using gmp_randinit_lc_2exp_size
> I'm thinking of std::length_error for a size bigger than the lc_2exp
> table data supports.  This would be like the std::string routines
> throw when asked to exceed their max_size.

This also sounds good.


Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
mailto:bagnara at

More information about the gmp-devel mailing list