On 10 Jan 2011, at 06:54, Jeppe Johansen wrote:

Doesn't the problem lie in that TFPGObjectList uses @ on the incoming parameters?

function TFPGObjectList.Add(const Item: T): Integer;
begin
 Result := inherited Add(@Item);
end;

Unless there's some magic going on, won't it then point to the stack, instead of the instance, in most cases?

Maybe it should use "constref" instead of "const". There's indeed no guarantee whatsoever that a "const" parameter will be passed by reference, and hence @item will indeed result in a stack address in many cases.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to