[fpc-pascal] Checking assignment compatibility
    Michael Van Canneyt 
    michael at freepascal.org
       
    Mon Jan  6 09:29:47 CET 2014
    
    
  
On Sun, 5 Jan 2014, Mark Morgan Lloyd wrote:
> Simulating a C-style conditional, I can do this
>
> function tf(const q: qword; const qt, qf: TObject): TObject; inline;
>
> begin
>  Assert(TypeOf(qt) = TypeOf(result));
This is always true. Everything descends from TOBject.
But assuming the result is not TObject, it would be
Assert((qt=Nil) or (qt.Inheritsfrom(TheResultClass))
Although that is still radically different from what the C style macro does.
Michael.
    
    
More information about the fpc-pascal
mailing list