[fpc-devel] Minor Error in $delphi mode for a unit I'm converting

Marco van de Voort marcov at stack.nl
Fri Jun 10 13:49:00 CEST 2005


> While converting a KOL regular expression unit for use with freepascal, I came
> across only one compile error, in {$mode delphi}
> 
> The error was here:
> const
>   RegExprInvertCaseFunction : TRegExprInvertCaseFunction=TRegExpr.InvertCaseFunction;
> 
> Error: Typed constants of the type "procedure of object" can only be initialized
> with NIL
> 
> The code below seemed to fix the problem, as it compiled ok.
> var
>   RegExprInvertCaseFunction : TRegExprInvertCaseFunction;
> 
> Is the error that I got correct even for delphi compatability? Is it bad code,
> good code?

It's bad code, unless it is a class method.




More information about the fpc-devel mailing list