[fpc-pascal] dynamic array as a part of dynamically allocated records behavior

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Feb 25 13:28:43 CET 2012


On 25 Feb 2012, at 13:23, leledumbo wrote:

> The code results in AV in the last WriteLn. Is this correct (i.e. intended
> behavior)?

Yes.

> If yes, what is the correct way to have the PR^.avl initialized
> just like TR.avl and x?

Use new(PR) instead of GetMem(SizeOf(TRuang)), or alternatively call initialize(PR^) after calling getmem (which new() does for you automatically).


Jonas


More information about the fpc-pascal mailing list