[fpc-pascal] allocating memory for records

Marc Santhoff M.Santhoff at t-online.de
Fri Jul 7 19:31:56 CEST 2006


Am Freitag, den 07.07.2006, 19:00 +0200 schrieb Vincent Snijders:
> Marc Santhoff wrote:


> > And another related question:
> > 
> > If a record has a String field, how is memory allacation handled?
> > 
> > MyRec = record
> > 	a: integer; /* very clear */
> > 	b: string; /* not clear, how much bytes are needed? */
> > end;
> > 
> > 
> 
> I would use:
>    new(x);
> and
>    dispose(x);

Ah, yes. I (k)new there was a more common solution. Nothing is more
"Wirth" than new() / dispose()!

> I guess the memory will initialized and finalized for strings correctly 
> in that case too, but I am not sure;

Anyone else knowing for sure?



Thank you very much Vincent,
Marc





More information about the fpc-pascal mailing list