[lazarus] circular unit reference

Andreas Hausladen Andreas.Hausladen at gmx.de
Sat Nov 15 10:04:04 EST 2003


----- 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.

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;


--
Regards,

Andreas Hausladen
(JVCL developer)
(http://www.kylix-patch.de.vu)






More information about the Lazarus mailing list