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

Sam Varshavchik mrsam at
Sat Jun 29 20:16:05 CEST 2013

Is there any interest in moving all the C++ bindings into their own  
namespace, say gnu::mp?

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  

typedef gnu::mp::mpz_class mpz_class;
typedef gnu::mp::mpf_class mpf_class;
typedef gnu::mp::mpq_class mpq_class;

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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <>

More information about the gmp-devel mailing list