[lazarus] circular unit reference
Mattias Gaertner
nc-gaertnma at netcologne.de
Sat Nov 15 10:12:20 EST 2003
On Sat, 15 Nov 2003 15:52:25 +0100
"Andreas Hausladen" <Andreas.Hausladen at gmx.de> wrote:
> ----- Original Message -----
> From: "Marc Weustink" <marc at dommelstein.net>
>
> > For those who wonder... this is why ifdefs make things unreadable
> >
> > - if FOnCompare=AValue then exit;
> > + if {$IFDEF FPC}{$ELSE}@{$ENDIF}FOnCompare={$IFDEF
> > FPC}{$ELSE}@{$ENDIF}AValue then exit;
>
> I know this. But as Delphi needs an @ operator for a comparison fpc does
> not need one. Maybe I should write{$ifdef FPC}
> if FOnCompare = AValue then Exit;
> {$else}
> if @FOnCompare = @AValue then Exit;
> {$endif}
> Here FPC's syntax is in my eyes ambigious because if AValue is a function
> with no arguments it could be a function call.
Only in Delphi mode.
In objfpc mode comparing function results needs FOnCompare() = AValue().
FOnCompare without brackets is always the TMethod/Pointer.
> Some features of FPC are better than Delphi's but Delphi also has features
> FPC does not have. Another example is the event assignment where I found
> FPC syntax better than Delphi's. Obj.OnClick := {$ifdef
> FPC}@{$endif}MyEventHandler;
Mattias
More information about the Lazarus
mailing list