Problem with assignment operator

Emmanuel Thomé Emmanuel.Thome at inria.fr
Tue Jan 11 21:27:25 CET 2005


On Tue, Jan 11, 2005 at 08:40:21PM +0100, Linus Nordberg wrote:
> The denominator mustn't be negative.  From the fine manual, section
> Rational Number Functions:
> 
> Wether a segfault is a reasonable punishment for not obeying this rule
> or not, I couldn't tell.  Cc to the GMP discussion list.

You're killed by the copy in mpq_set. Not surprising, as input
requirements are not met. period.

The c++ ctor should perhaps call mpq_canonicalize ; sounds reasonable to
me at least.

E.


More information about the gmp-discuss mailing list