[fpc-pascal] allocating memory for records

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


Am Freitag, den 07.07.2006, 10:09 -0700 schrieb Leonardo M. RamX:
> Marc,
> you don't need to allocate memory for records, you can us as follows:
> 
> type
>   MyRec = record
>     a: integer; /* very clear */
>     b: string; /* not clear, how much bytes are needed? */
>   end;
> 
> var
>   myRecVar: MyRec;
> 
> begin
>   myRecVar.a := 10;
>   myRecVar.b := 'Hello World!';
> end;

Yes, I know. But in this case I definitely have to because a static
variable disappears outside a function declaring it, so I need a
solution that is robust and portable.

But thank you anyways, a helping hand is always welcome.

Marc





More information about the fpc-pascal mailing list