[fpc-pascal] getmem
Luis Fernando Del Aguila Mejía
luis3000 at ec-red.com
Tue May 24 20:57:31 CEST 2011
>>I'm surprised this compiles at all.
Ok, Does my program does not compile on your computer ?
>>You're mixing up manual allocation of memory on the heap for variables
>>such as arrays with compiler allocation of heap memory for ansistrings
>>(which are reference counted and deallocated automatically).
Yes something like that. I'm trying to emulate something like this:
VarLCad = array[0..2] of ansistring;
Begin
LCad[0]:='01234';
LCad[1]:='56789';
LCad[2]:='11111';
Writeln(LCad[2]);
End.
But using GetMem(LCad,4*3) for the array. (4 bytes for the ansistring
pointer).
This can be done with: TList. But I write these simple programs, to know
how compiler works.
More information about the fpc-pascal
mailing list