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

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Mar 14 08:59:26 CET 2013


On Wed, 13 Mar 2013 11:32:43 +0000
Howard Page-Clark <hdpc at talktalk.net> wrote:

> On 13/03/13 9:50, Mattias Gaertner wrote:
> > On Wed, 13 Mar 2013 09:35:43 +0000
> > Howard Page-Clark <hdpc at talktalk.net> wrote:
> >
> >> On 12/03/13 8:30, Xiangrong Fang wrote:
> >>> TMyClass = class
> >>>       myarray: array[0..100] of Integer;
> >>> end;
>[...]
> Could you show a more complex test that would give a satisfactory 
> answer to the OP's questions?

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 the
allocation. 
You can try to create the class, change it, free it and
allocate it again. If the two instances are at the same position, then
you can check for 0 or nil.


Mattias



More information about the fpc-pascal mailing list