Jonas Maebe jonas at zeus.rug.ac.be
Wed Oct 23 11:34:27 CEST 2002

On woensdag, okt 23, 2002, at 11:20 Europe/Brussels, 
memsom at interalpha.co.uk wrote:

>> type t = object
>> procedure p(s:t);
>> end;
>> procedure t.p(s:t);
>> begin
>> self:=s;
>> end;
> Shouldn't 'procedure p(s:t);' actually have a pointer to 't' rather 
> than a
> stack allocated 't'?

Because he's working with objects and wants to replace the contents of 
the current object with another one: no (it could be designated "const" 
for better performance maybe). Remember, in an object (as opposed to a 
class instance), self is not a pointer but the object itself. So he's 
just overwriting the contents of the object with some other contents. I 
agree it's ugly, but it won't create a memory leak.


More information about the fpc-pascal mailing list