[fpc-devel] comparing methods

Michael Schnell mschnell at lumino.de
Fri Sep 11 09:04:28 CEST 2009


Mattias Gärtner wrote:
> 
> The @ operator is more than "address of".
> 

Hmm "Address of" is not that simple in itself. :)

With a "Procedure of Object", "@" of course handles the Self pointer, too.

I suppose to find the address of a function "@" uses the Virtual Method
Table found with the Self pointer.

So in fact there are (at least) two ways of implementing a compare
between two pointers to "Procedure of Object" variables, that IMHO both
make sense:

1) Simply compare the Self and the Address part (the same function of
two implementations of a class are different)

2) Compare only the address (the same function of two implementations of
a class are identical, unless overloaded by a child's function).

I think it's a matter of taste (I do vote for (2) ).

-Michael





More information about the fpc-devel mailing list