[fpc-devel] TBytes

Martin Schreiber mse00000 at gmail.com
Tue Feb 28 09:28:38 CET 2012


Am 28.02.2012 10:10, schrieb Sven Barth:
> Am 28.02.2012 09:07, schrieb Martin Schreiber:
>> Am 28.02.2012 09:46, schrieb Sven Barth:
>>
>>>
>>> You are right, I checked the code of SetLength for arrays and strings
>>> and only arrays use FillChar. Nevertheless there is no other operation
>>> you can use for arrays.
>>>
>> Same in Delphi?
>
> I can't tell whether Delphi also uses FillChar (because I won't look at
> the source of Delphi's RTL), but there is also no other operation.
>
So using TBytes instead of FPC 2.6 AnsiString as buffer has a 
performance penalty.
It has a convenience penalty too because TBytes can not be concatenated 
by "+". Using operator overloading is maybe not Delphi compatible and 
probably has less performance than the optimized concat*() string 
compiler procs. There AFAIK also is no convenient way to concatenate 
TBytes with string constants and variables.

Martin



More information about the fpc-devel mailing list