[fpc-devel] TBytes

Martin Schreiber mse00000 at gmail.com
Tue Feb 28 11:14:26 CET 2012


Am 28.02.2012 11:59, schrieb Marco van de Voort:
> In our previous episode, Martin Schreiber said:
>>> If you care, you can do manual management.
>>
>> Yup, MSEgui has allocuninitedarray() for the purpose. I don't think it
>> is more "clean" or "secure" than the old ansistring method because it
>> depends on compiler internals.
>
> getmem/freemem ?
>
And the layout of the variable array record.

>>> Or pool arrays of byte. (I do
>>> this in my Delphi app, where I have a nice generic pool class).
>>>
>> I like handy tools. Using FPC 2.6 AnsiString as buffer is handy.
>
> IMHO it is an abuse. One could discuss if internal usage is a big problem (I
> think that is still bad though, but if you switch typing string to explicit
> ansistring, there is no rush), but I think at least public
> programming interfaces should be free of such gotchas.
>
[...]

Then please implement such a handy character string compatible automatic 
memory managed buffer type.
And please don't wait until Delphi has made it or Delphi changed string 
handling completely again which seems to be possible according a thread 
with Allen Bauer in Embarcadero forum. And please implement it before 
AnsiStrings can't be used for the purpose anymore.

Thanks, Martin



More information about the fpc-devel mailing list