[fpc-pascal] How can I implement "thrice" in Free Pascal?
Florian Klämpfl
florian at freepascal.org
Wed Oct 19 20:09:56 CEST 2011
Am 19.10.2011 10:49, schrieb Sven Barth:
> Am 19.10.2011 10:27, schrieb Jonas Maebe:
>>
>> On 19 Oct 2011, at 09:59, Marco van de Voort wrote:
>>
>>> In our previous episode, Sven Barth said:
>>>>> This implementation will result in crashes if T is a
>>>>> reference-counted type.
>>>>
>>>> Right... I tend to forget about these... what would the correct way to
>>>> copy an array of ref counted types? E.g. an "array of string"?
>>
>> For-loops.
>
> *sigh*
>
> For-loops it is then...
Compared with the affort for ref. counting this is negliable imo. Modern
processors don't perform that bad on a simple loop to copy memory.
>
>>> copy () ? :-)
>>
>> copy() cannot be used to concatenate two arrays, because it is a
>> function that returns a new array with contantes of (a potentially
>> sub-array of) the original array.
>
> That's what I remembered about "copy" as well.
Copy does a one level deep copy.
More information about the fpc-pascal
mailing list