Re[2]: [fpc-pascal] about dynamic array

2010-05-09 Thread José Mejuto
Hello FPC-Pascal,

Sunday, May 9, 2010, 8:04:24 PM, you wrote:

s Sorry to have launched such an argument by starting a new
s thread about dynamic array. My purpose, as a newcomer discovering
s the world of fpc, was just to get information I could not find
s myself to help me and progress in the jungle ;-)

From every discussion something new emerge :)

-- 
Best regards,
 José

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: Re[2]: [fpc-pascal] about dynamic array

2010-05-08 Thread Vinzent Höfler
 c TList wraps TFPList, which is based internally on an array. So access
 c is fast; insertion, deletion not.
 
 But it is faster than inserting elements in a dynamic array (unless
 reference counted ones) because it usually moves less amount of data
 (4/8 bytes per element).

Implementing a dynamic array via a list implementation which is based on a 
dynamic array. Sure, that's faster.
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re[2]: [fpc-pascal] about dynamic array

2010-05-06 Thread José Mejuto
Hello FPC-Pascal,

Thursday, May 6, 2010, 3:53:59 PM, you wrote:

c TList wraps TFPList, which is based internally on an array. So access
c is fast; insertion, deletion not.

But it is faster than inserting elements in a dynamic array (unless
reference counted ones) because it usually moves less amount of data
(4/8 bytes per element).

-- 
Best regards,
 José

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re[2]: [fpc-pascal] about dynamic array

2010-05-06 Thread José Mejuto
Hello FPC-Pascal,

Thursday, May 6, 2010, 8:58:33 PM, you wrote:

 faster in fact. If the user plans to use a record (which is my
 suspect) with TList he must new and dispose the elements and he
 will end up with a dyn array of pointers after all, which is a TList.
FK A dyn. array of records requires no new/dispose as well as no type casts
FK as TList does.

OK, I see :) Do you remember how this ver long thread starts ?

A: array of MyArray;
SetLength(A,x);
A[0]:=MyArrayElement;
Move(A,B,sizeof..);

Entering the doom again... Next question could be why:

p1: TObject;
p2: TObject;
p1:=TObject.Create();
p2:=p1;
P1.free;
p1:=nil;

Why I get an AV if accesing p2 ? Because the object has been freed...
So why is not p2 = nil as p1 ?

This kind of messages will end up or in a master class of pointers for
dummies or a lot of developers dropping the list for days.

I had proposed the solution that I think is easy to understand what
happends behind the scenes or maybe I wrongly choose the moment of hit
reply :(

-- 
Best regards,
 José

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re[2]: [fpc-pascal] about dynamic array

2010-05-06 Thread José Mejuto
Hello FPC-Pascal,

Thursday, May 6, 2010, 9:50:34 PM, you wrote:

DC The short answer is because you have not set p2 to nil as you did to p1.

I do not want to be rude but, do you read all the message ? I was
trying to be ironic, but seems that I was unable maybe due my very
limited english, sorry.

-- 
Best regards,
 José

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal