[interfacekit] Re: BString patch suggestion and some questions,too

On 2003-11-04 at 08:46:10 [+0100], you wrote:
> > Is that true? You can store more information a similar way as it is 
> > already
> > done with the length -- in space allocated before the currently exposed 
> > data.
> 
> Unfortunately, there are two inline functions (String() and Length()) that 
> assume that the first 4 bytes are reserved for the length, and then there's 
> the real string.
> So, no way :)

String() and Length() only expose what is stored starting at `_privateData - 
4'. You can e.g. simply allocate four more bytes, set _privateData to the 
allocated pointer + 8 and store another int32 at `(int32*)privateData - 2'. 
So the amount of additional data that can be stored is limited only by what 
malloc() is willing to grant. :-)

BTW, AFAIK, Dano actually changes the implementation of BString to add copy 
on write or even nicer things (I haven't had a closer look at it yet).

CU, Ingo

Other related posts: