This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: std::string::reserve()


Neil Ferguson wrote:

I've attached diffs against latest CVS that try to avoid doing
this, and I'd be interested to know what you think.

Hi Neil, thanks for your message. A few observations:


1- If you plan contributing patches of this size you definitely need a
  copyright assignment on file:

http://gcc.gnu.org/contribute.html

2- Your change definitely makes sense but not calling _M_clone has
  a not-completely-obvious effect: if the string is in the leaked
  state it remains leaked, doesn't become sharable. Perhaps you
  want to return early only if the string is already sharable?
  A leaked string cannot be refcopied and avoiding the _M_clone
  call could imply having to call it *many* times later in an
  assign, in a constructor or what else...

3- Please, please strive to have a working regtesting setup. It's
  important not only to spare us the task (that's not a big deal)
  but also when fixing bugs or envisaging large scale changes...

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]