http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52938

--- Comment #12 from Abdul Tohmaz <abdul.tohmaz at emc dot com> 2012-04-12 
23:07:32 UTC ---
(In reply to comment #11)

> The benefits and problems of reference-counted strings are well known and it's
> not going to be changed now, std::string is stable and effectively frozen
> except for serious bugs.  This isn't a bug, it's behaviour allowed by the C++
> 2003 standard, even if it's not the behavior you expect or want.

Now I understand the reason for choosing not to fix.  But I can't agree with
the statement saying this is not a bug.  Here is why.

The user could care less if we use copy-on-write in the string implementation. 
The standard doesn't force that (21.3.6).  

We are violating what the standard says about reserve (20.3.10/20.3.11).  Here
it is:
"Effects: after reserve(), capacity() is greater or equal to the argument of
reserve".

That is it.  if I call reserve(1024) on a string, from that point on, capacity 
should return at least 1024. 

As a user (with access to the standards), I don't see where it says that it is
ok to violate 21.3.10/20.3.11.  If you find it, please let me know.

Reply via email to