Boost logo

Boost :

Subject: Re: [boost] [any] new version
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2011-09-02 02:42:05


On 09/01/2011 11:45 PM, Martin Bidlingmaier wrote:
> Ok, so obviously the proposed version won't work when instances of boost::any cross dll borders.
> I see only one possible way out without breaking existing code (and still
> use the new version, if it is considered superior):
> Let the user explicitly declare he wants to use the version with statics by
> introducing a new configuration macro, e.g. BOOST_ANY_NO_DLL_CROSSING,
> or use an existing macro that does the same thing. If not defined, type_info comparsion would be used.

I don't really like the macro idea because it breaks ABI. Consider this.
On Linux, and probably other UNIX systems, Boost libraries are provided
as shared libraries. So if I use system Boost.ProgramOptions, for
instance, I'm linking with a shared library. But Boost.ProgramOptions
uses boost::any and AFAIR it passes it across library boundaries. So my
application will not be able to use the optimized boost::any.

I understand that there are cases when you link with no shared libraries
and eager to squeeze that little extra bit of performance. But honestly,
does that change really make a difference in the context of your
application? And if it does, perhaps your case is special enough to
create a separate component, say, local_any? Or take a different
approach in your design altogether?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk