peter at freepascal.org
Fri Jun 1 23:21:31 CEST 2001
> TCl = class
> a: AnsiString;
> procedure load;
> procedure adddata (var buffer; l: dword);
> setlength (a, length (a) + l);
> move (buffer, (pointer (a) + length (a))^, l);
> adddata (pointer(a)^,length (a));
> Cl: TCl;
> Cl := TCl.create;
> Seems to be that in "adddata" variable "a" is handled somehow
> incorrectly or something...
This is not a bug in the compiler or RTL. Your code is wrong because it
assumes that the setlength doesn't change the pointer of an ansistring
which is not true. When setlength requires more space it can be necessary
to allocate a new memory block elsewhere in the memory.
> There is also an inline problem in v1.1. That was for some time
> solved and now it appered again.
Which bug ?
More information about the fpc-devel