exception handling in set_str functions
Matthew Niemerg
research at matthewniemerg.com
Tue Jun 16 07:01:35 UTC 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi all,
I am working on a project that makes use of gmp and started to do some
simple tests with exception handling.
I noticed that two functions (in mpz_class, mpq_class, mpf_class)
int set_str(const char *s, int base)
and
int set_str(const std::string &s, int base)
simply modify the internal mp object in their respective classes by
calling the appropriate
int mp*_set_str(const char *s, int base)
function.
The constructor methods, on the other hand, do throw exceptions when
the string literal cannot be converted.
Shouldn't these methods also perform exception handling?
Matthew Niemerg
Institute for Interdisciplinary Information Sciences
Tsinghua University
Beijing, China
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iF4EAREIAAYFAlV/yc8ACgkQrXhoUZB1ALuHDQD9Fzz6U8xviKQjLH+aD9N5bZoK
SmmVCQny/74iKsYKzjoA/0KkPSJLdxEOLl8ZOS/LGJcQsYmc5YZ9B3BOrsdYekZz
=ac/3
-----END PGP SIGNATURE-----
More information about the gmp-discuss
mailing list