Bihar Anwar schreef:
I've tried to use Move() instead of Copy(). Any objection with the following
code?
Yes, at first glance without much thinking, I don't think it is safe. Did you think
through the consequences of copying reference counted types (ansistring in this case
presumably)?
On 28 April 2010 04:24, Bihar Anwar bihar_an...@rocketmail.com wrote:
Ok, I'll try to observe the compiled code using debugger and benchmark it if
needed. BTW, what do you mean by allocating memory directly? Is there another
way to allocate memory for dynamic array besides using SetLength()?
Vincent Snijders wrote:
Bihar Anwar schreef:
I've tried to use Move() instead of Copy(). Any objection with the following
code?
Yes, at first glance without much thinking, I don't think it is safe. Did you
think through the consequences of copying reference counted types (ansistring
in
On 28 April 2010 05:33, Bihar Anwar bihar_an...@rocketmail.com wrote:
I've tried to use Move() instead of Copy(). Any objection with the following
code?
var
a: array of string;
SetLength(a, 5);
a[0] := 'aa'; a[1] := 'bb'; a[2] := 'cc'; a[3] := 'dd'; a[4] := 'ee';
System.Move(a[3],
Thank you very much Henry, David, and Vincent. I think, I must go back to the
basic of reference counting. Special thanks to David for the detail explanation.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
On Tue, Apr 27, 2010 at 5:42 PM, Bihar Anwar bihar_an...@rocketmail.com wrote:
Just say, I have a dynamic array with size=5, and I want to delete elements
from the index 0 to 2. Is there a trick (the fastest way) to delete those
elements (0 to 2) without moving activities?
You won't do it
On 27 April 2010 14:42, Bihar Anwar bihar_an...@rocketmail.com wrote:
Just say, I have a dynamic array with size=5, and I want to delete elements
from the index 0 to 2. Is there a trick (the fastest way) to delete those
elements (0 to 2) without moving activities?
I've tried to make the
- Original Message
From: Henry Vermaak henry.verm...@gmail.com
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Sent: Tue, April 27, 2010 10:19:45 PM
I think the right way to do this is:
a := copy(a, 3, length(a) - 3);
Presumably copy optimizes this adequately.
Henry
On 27 April 2010 18:34, Bihar Anwar bihar_an...@rocketmail.com wrote:
Would Move() be faster, instead of Copy()?
I guess so, have you tried to benchmark? If you really need speed,
why don't you allocate the memory directly?
Henry
___
fpc-pascal
...@gmail.com
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Sent: Wed, April 28, 2010 4:12:26 AM
Subject: Re: [fpc-pascal] Question about Deleting elements in Dynamic Array
On 27 April 2010 18:34, Bihar Anwar bihar_an...@rocketmail.com wrote:
Would Move() be faster, instead of Copy()?
I
On Wed, Apr 28, 2010 at 7:24 AM, Bihar Anwar bihar_an...@rocketmail.com wrote:
Ok, I'll try to observe the compiled code using debugger and benchmark it if
needed. BTW, what do you mean by allocating memory directly? Is there another
way to allocate memory for dynamic array besides using
(a, 2);
- Original Message
From: dmitry boyarintsev skalogryz.li...@gmail.com
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Sent: Wed, April 28, 2010 10:31:09 AM
Subject: Re: [fpc-pascal] Question about Deleting elements in Dynamic Array
On Wed, Apr 28, 2010 at 7:24 AM
12 matches
Mail list logo