Hi! I'm doing my tasks with fpc in linux, but in the university we have only tp, and there are several problems with bringing binaries. I have such code to have something like dynamic arrays:
procedure add_mem(var P: dynamic_array_ptr; var cur_size:Integer);
var
i:Integer;
buff_ptr:dynamic_array_ptr;
begin
getmem(buff_ptr,cur_size*sizeof(BusStation) );
for i:=1 to cur_size do
buff_ptr^[i] := P^[i];
freemem(P);
cur_size:=cur_size+buf_count;
getmem(P,cur_size*sizeof(BusStation) );
for i:=1 to (cur_size-buf_count) do
P^[i] := buff_ptr^[i];
freemem(buff_ptr);
cur_size:=cur_size+buf_count;
end;In fpc it works. But in tp my programme sometimes starts from last time and have a part of last data and some garbage (not text). Why does it work in fpc, but doesn't in tp? I see the only way to rewrite code, but I want to know why.
