[fpc-devel] Compiler bug?

cobines cobines at gmail.com
Sun Jan 31 08:46:58 CET 2010

2010/1/31 Paul van Helden <paul at planetgis.co.za>:
> function TMyClass.GetValue_overloaded(SomeValue: Integer): Integer;
> begin
>  case SomeValue of
>    1: Result:=GetValue_overloaded; // compiler warning: "Function result
> variable does not seem to be initialized" (!)
>    2: Result:=GetValue_not_overloaded;
>  else
>    Result:=3;
>  end;
> end;

Isn't the "GetValue_overloaded" in

  1: Result:=GetValue_overloaded

the return value of the function?

Maybe you should call it this way:

Result:= GetValue_overloaded()

That's why I think you get the warning.

The reason you might be getting random results is that the return
value has not been initialized.


More information about the fpc-devel mailing list