From: Gregory Dai (gregory.dai_at_[hidden])
Date: 2006-09-01 18:26:11
On 9/1/06, John Maddock <john_at_[hidden]> wrote:
> Gregory Dai wrote:
> >> Have I got that right?
> > Well, not completely perhaps. E.g., at least if the target is a
> > std::string of size=0, the resultant std::string may well be
> > reference-counted and shared by multiple threads.
> Can you explain some more? Are you saying that if two unrelated threads
> each default construct a string (or maybe construct a zero length string?)
> then they will be entangled by reference counting?
Well, I don't have definitive proof, but that's possible from my experience.
E.g., we have many classes with ctors like this: ctor(..., std::string
const& s = std::string());
More than a few developers had such experience that a crash could well be
made disappear by changing the type of "s" to char const* (and, of course,
passing whatever the string as string.c_str() to the ctor).
We just had too many of it (and for a few other reasons) our solution was
eventually replacing std::string with one that does not use the
> Unsubscribe & other changes:
-- Thanks, Greg
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk