summaryrefslogtreecommitdiff
path: root/gmpxx.h
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2003-10-18 23:49:50 +0200
committerKevin Ryde <user42@zip.com.au>2003-10-18 23:49:50 +0200
commit9fb6efcfea3dfea125d603c4ac8fc50015cdb2f1 (patch)
tree17fdb6f798c449b7831077b1c80a672b97c4305e /gmpxx.h
parente23ce787f98034a6d3f99faebde1b71f2fd50a0b (diff)
downloadgmp-9fb6efcfea3dfea125d603c4ac8fc50015cdb2f1.tar.gz
* gmpxx.h (gmp_randclass gmp_randinit_lc_2exp_size constructor): Throw
std::length_error if size is too big.
Diffstat (limited to 'gmpxx.h')
-rw-r--r--gmpxx.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/gmpxx.h b/gmpxx.h
index 296ede285..66add967e 100644
--- a/gmpxx.h
+++ b/gmpxx.h
@@ -5505,7 +5505,10 @@ public:
// gmp_randinit_lc_2exp_size
gmp_randclass(__gmp_randinit_lc_2exp_size_t* f,
unsigned long int size)
- { f(state, size); }
+ {
+ if (f (state, size) == 0)
+ throw std::length_error ("gmp_randinit_lc_2exp_size");
+ }
~gmp_randclass() { gmp_randclear(state); }