Moving C++ bindings in gmpxx.h into a namespace
mrsam at courier-mta.com
Sun Jun 30 15:54:02 CEST 2013
Marc Glisse writes:
> On Sat, 29 Jun 2013, Sam Varshavchik wrote:
>> Is there any interest in moving all the C++ bindings into their own
>> namespace, say gnu::mp?
> Vaguely. Preferably at the same time as some other ABI-breaking changes.
>> 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.
> The risk of clashing is very low. We currently use the old C namespacing
> technique of giving all names an application-specific prefix (plus we
> illegally put most names in the implementation namespace). Did you hit a
> particular issue or are you just suggesting it because it sounds good?
I was pondering including gmp internally as part of another C++ library,
that has its own vanity namespace; where I follow the principle of not
adding its symbols to the global namespace; I think that should be entirely
for client apps, so I like not to meddle therer.
>> 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.
> I'd probably import the names to the global namespace by default anyway, so
> no point complicating things too much.
That'll work too; as long as it's possible to avoid that, and possible to
import only the library-specific namespace.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: not available
More information about the gmp-devel