[haiku-commits] Re: haiku: hrev50860 - src/kits/support headers/os/support src/apps/deskcalc src/preferences/keymap src/preferences/mail

  • From: "Adrien Destugues" <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 12 Jan 2017 07:40:59 +0000

We could re-implement the operator to make the string writable, but it
would become a very costly operation, which does not seem wise for
something that looks as innocent as accessing a byte in a string.

For completeness: this is what was done for gcc5. The BStringRef object 
temporary allocated by the operator managed the string internals to make the 
string writable and temporarily increment its reference count. It also did not 
prevent the second problem (direct access to the string buffer by taking the 
address of the reference).

-- 
Adrien.

Other related posts: