On dinsdag, feb 25, 2003, at 15:01 Europe/Brussels, Anton Tichawa wrote:


What object code is generated for this? I assume that, informally speaking,

Ord(TClassB) = Ord(@VMT)

and that

if x IS TClassB

yields somthing like

if @(x.VMT) = TClassB?

Am I wrong here?

Yes, because "is" also returns true if the instance is of a type that inherits from tclassb. So the "is" operator is translated into a call to the following helper routine


function fpc_do_is(aclass : tclass;aobject : tobject) : boolean;[public,alia
s: 'FPC_DO_IS']; {$ifdef hascompilerproc} compilerproc; {$endif}
begin
fpc_do_is:=assigned(aobject) and assigned(aclass) and
aobject.inheritsfrom(aclass);
end;



Jonas


_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to