Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-14 Thread Howard Page-Clark
On 14/03/13 7:59, Mattias Gaertner wrote: Xiangrong wanted to know if the above array is initialized. If you want to test that then you have to either single step via the debugger or to compare the allocated memory before and after. The problem is that you do not know the memory position before

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-14 Thread Mattias Gaertner
On Wed, 13 Mar 2013 11:32:43 + Howard Page-Clark wrote: > On 13/03/13 9:50, Mattias Gaertner wrote: > > On Wed, 13 Mar 2013 09:35:43 + > > Howard Page-Clark wrote: > > > >> On 12/03/13 8:30, Xiangrong Fang wrote: > >>> TMyClass = class > >>> myarray: array[0..100] of Integer; > >>>

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Sven Barth
Am 13.03.2013 10:45 schrieb "Xiangrong Fang" : >> >> Yes, in that case it will be Nil (Note: in the static case the elements of the array would be 0). > > > So, it is even OK to use SetLength() on static arrays? interesting. No, I meant that the content of a static array will be initialized to zer

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Howard Page-Clark
On 13/03/13 9:50, Mattias Gaertner wrote: On Wed, 13 Mar 2013 09:35:43 + Howard Page-Clark wrote: On 12/03/13 8:30, Xiangrong Fang wrote: TMyClass = class myarray: array[0..100] of Integer; end; You could answer such questions yourself: Not with this simple test. [...] my:

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Mattias Gaertner
On Wed, 13 Mar 2013 09:35:43 + Howard Page-Clark wrote: > On 12/03/13 8:30, Xiangrong Fang wrote: > > TMyClass = class > > myarray: array[0..100] of Integer; > > end; > You could answer such questions yourself: Not with this simple test. >[...] >my:=TMyClass.Create; >try >

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Xiangrong Fang
> > Yes, in that case it will be Nil (Note: in the static case the elements of > the array would be 0). > So, it is even OK to use SetLength() on static arrays? interesting. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepas

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Sven Barth
Am 13.03.2013 10:08 schrieb "Xiangrong Fang" : > > Sorry the array should be dynamic, without [0..100]. > > Yes, in that case it will be Nil (Note: in the static case the elements of the array would be 0). Regards, Sven ___ fpc-pascal maillist - fpc-p

Re: [fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Howard Page-Clark
On 12/03/13 8:30, Xiangrong Fang wrote: TMyClass = class myarray: array[0..100] of Integer; end; You could answer such questions yourself: program Project1; {$mode objfpc} type TMyClass = class myarray: array of Integer; end; var my:TMyClass; begin my:=TMyClass.Create; try wri

[fpc-pascal] Re: two questions about dynamic array

2013-03-13 Thread Xiangrong Fang
Sorry the array should be dynamic, without [0..100]. 2013/3/12 Xiangrong Fang > Hi All, > > I have two simple questions: > > 1) As far as I know class variables in FPC are automatic initialize to the > NULL value (e.g. 0 or "" or whatever), does that include dynamic arrays? > e.g. > > TMyClass =