[lazarus] Calling boolean type function

Florian Klaempfl Florian.Klaempfl at gmx.de
Thu Mar 30 10:35:18 EST 2000


Jean Bénard schrieb:
> 
> At 02:09 30/03/00 +0100, you wrote:
> >Hi, I got the following problem:
> >
> >function Test: Boolean
> 
> JB : well a ; is missing here (it wasn't a copy/paste !)
> 
> >begin
> >end;
> >
> >type
> >   TMyFunc = function: Boolean;
> >var
> >   b: Boolean;
> >   MyFunc: TMyfunc;
> >
> >begin
> >   MyFunc := @Test;
> 
> in Delphi for Windows, the @ is refused as well
> while it compiles without @
> 
> >   b := MyFunc;
> >end;
> >
> >The compiler complains about:
> >
> >   Error: Incompatible types: got "TMYFUNC" expected "BOOLEAN"
> >
> >Am I missing something ??

Try

b:=MyFunc();

else FPC believes you want to copy the contents of MyFunc to b.

> 
> No : on the contrary, the @ should be dropped.
> 
> Jean Bénard Informatique premier cycle
> Bât 336 Campus d'Orsay
> 91405 ORSAY Cedex
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>     archives at http://www.miraclec.com/list_archives/lazarus






More information about the Lazarus mailing list