std::string exorcism hiccup

Phil Edwards phil@jaj.com
Sat Jun 15 04:08:00 GMT 2002


On Sat, Jun 15, 2002 at 10:37:43AM +1200, Tony Bryant wrote:
> > OK, I don't claim to be clever enough to post a solution this issue in
> > the context of a 5-minute e-mail, but I'd agree that this internal
> > implementation policy should be more tunable for embedded platforms.
> > The problem is that most traditional solutions to this problem would
> > require a complete recompilation of the library... (In fact, I must
> > concede that the __USE_MALLOC recompilation option might be the best
> > case for tiny embedded systems; since by starving themselves of
> > memory, they have all but agreed to the Faustian pact with the Devil)
> 
> The general solution lies somewhere in the elimination of a precompiled 
> libstdc++.a, If libstdc++ was entirely based on automatically instantiated 
> templates, then a simple global #define would suffice.

Well, the changes that I'd like to make to the default pool allocator
would involve

    a) making its behavioral parameters tunable by #definitions before
       #including any standard library header, so users could preempt us, and
    b) making its behavioral parmeters part of its template parameter list,
       so that such user tuning results in a different type, a different
       type mangling, and no linker conflicts with the precompiled symbols
       in libstdc++.*.

I floated the idea the last type the question of allocators came up, and
the (admittedly vaguely ugly) idea of (b) was not so much "shot down" as
"vomited on" due to its ugliness.  :-)

The ugly part I think is that the different mangling would not actually
apply to std::allocator, but rather to a type buried way down in the
instantiation chain.  Everything would still work -- the changed default
pool allocator would be implicitly instantiated in the user's own object
files -- but it would have to be well-documented.

Opinions, anyone?  (go go gadget asbestos underwear!)



Phil

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams



More information about the Libstdc++ mailing list