Moving C++ bindings in gmpxx.h into a namespace

Joerg Arndt arndt at jjj.de
Sun Jun 30 18:25:06 CEST 2013


* Sam Varshavchik <mrsam at courier-mta.com> [Jun 30. 2013 08:13]:
> Is there any interest in moving all the C++ bindings into their own
> namespace, say gnu::mp?
> 

I wonder why not just gmp::  ?


> This is popular with many C++ dev libraries, like boost, for example.
> There are several advantages with doing that; mainly reducing the
> risk of clashing with application's own symbols, or even with
> symbols from other libraries that an app also links to.
> 
> I can prepare a patch to do that, if there's interest.
> 
> Compatibility with existing code is trivial. Either provide a
> separate file that existing code can include, that contains a grand
> total of three typedefs:
> 
> typedef gnu::mp::mpz_class mpz_class;
> typedef gnu::mp::mpf_class mpf_class;
> typedef gnu::mp::mpq_class mpq_class;

As just said in another email, 'using::xyz_class' instead of
these 'typedef's appears preferable.


> 
> Or, for 100% source backwards compatibility, rename gmpxx.h to
> something else, and have it declare everything in gnu::mp, and
> replace gmpxx.h with a stub that includes the real file, and
> provides the three typedefs.
> 

Best,  jj


> _______________________________________________
> gmp-devel mailing list
> gmp-devel at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-devel



More information about the gmp-devel mailing list