[v3] libstdc++/16612

Nathan Myers ncm-nospam@cantrip.org
Sat Sep 25 04:25:00 GMT 2004


On Fri, Sep 24, 2004 at 11:25:42PM +0200, Paolo Carlini wrote:
> Benjamin Kosnik wrote:
> 
> >Ok, here we go again. I believe this to now be conformant. Hurray.
> >
> >I'll wait 24 hrs for comments, and then check in a backport. (Which I
> >believe will be possible for 3.4/4.0).
> > 
> Frankly, I cannot support this kind of approach:
> ... 
> Having a conditional for the most fundamental operation, that is
> character access, doesn't seem a price that can be paid in order to
> easily support shared memory.

I have to agree.  The change violates the principle that users should
not pay for what they don't use.  This would slow down everyboy for
the convenience of the vanishingly few who try to park strings in 
shared-memory regions.

Some people have suggested that it should be possible to build a 
version of the library in which string _Rep instances are not shared 
at all.  (They say that, particularly in massively-parallel machines, 
the cost of the memory barrier used for atomic operations can be 
greater than the cost of allocating, deallocating, and block-copying 
the characters!)  In such an implementation, shared memory would not 
be a special case.

It seems to me that such a variant might be much more widely useful
than one tailored just for shared-memory regions.

I would still like to discover a way to do without the empty-string
_Rep when the library is built as at present and as a shared library,
because it turns out that even getting the address of static data in 
a shared library is absurdly expensive.

Nathan Myers
ncm-nospam@cantrip.org



More information about the Libstdc++ mailing list