mini-gmpxx - mini-gmp C++ interface

Marc Glisse marc.glisse at inria.fr
Fri Jul 12 15:42:14 UTC 2019


On Fri, 12 Jul 2019, Vladimir S. FONOV wrote:

> I needed a mini version of gmp, to work with C++ inteface, so I created
> mini-gmpxx.h (gmpxx.h for mini-gmp) , mostly for the purpose of compiling
> cork on macOS without libgmp present, take a look in
> https://github.com/vfonov/cork/tree/master/contrib/gmp-6.1.2/mini-gmp , it

Thanks for sharing.

> is basically original gmpxx.h with commented out pieces of code that
> wouldn't work without mpq and mpf interfaces.

Note that we have a mini-mpq now.

> I also had to add couple of defines from omp.h to mini-omp.h , so there are
> small changes too.
>
> Maybe it would be of interest to somebody?

I guess if it used some #ifdef instead of commenting out the code, so the 
same file could be user for gmp and mini-gmp, it could be interesting (not 
particularly to me since I never used mini-gmp, but to others). Maybe 
gmpxx.h could check if __MINI_GMP_H__ is defined and in that case not 
include gmp.h and not use anything mpf-related. __MINI_MPQ_H__ could be 
used to conditionally enable mpq if we don't want to enable it by default. 
(I am not saying any of the above is a good idea, just the first things 
that come to mind)

Or we could have a much more simplistic mini C++ wrapper without 
expression templates, if we are going to maintain 2 versions, although I 
am not fond of the idea of maintaining 2 versions.

I don't see a corresponding mini-gmpxx.cc file. That could cause problems 
for numeric_limits at least.

You kept some operator<< that seems unlikely to compile.

-- 
Marc Glisse


More information about the gmp-devel mailing list