gmp's c++ interface / mpz_class

Tom Tromey tromey@adacore.com
Mon Oct 17 17:21:51 GMT 2022


>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:

Pedro> In gdb/gmp-utils.h.  However, we need do to arithmetic on the type, and this wrapper
Pedro> type doesn't implement operator+, operator-, etc, etc.  I guess we could add those,
Pedro> as wrappers around mpz_add, etc.  Or use raw mpz_add, etc. directly.  However, I just found
Pedro> out that GMP already has its own C++ interface:

Pedro>  https://gmplib.org/manual/C_002b_002b-Interface-General

Pedro> Before we explore this further, is there an already known reason we shouldn't be using
Pedro> that interface?

I feel sure Joel and I have talked about it, but I don't remember what
reason there was any more.  The warning in the manual is a bit
off-putting, though:

       *Everything described in this chapter is to be considered preliminary
    and might be subject to incompatible changes if some unforeseen
    difficulty reveals itself.*

Pedro> Not sure yet whether efficiency really matters in practice, but I suspect it does.

I'm curious about this as well.

FWIW I've occasionally thought about replacing parts of valarith with GMP.
That way gdb could more easily support 128-bit integers.

Tom


More information about the Gdb mailing list