If I have the code as shown at the end of the mail, i get

project1.lpr(6,9) Warning: Function result variable does not seem to initialized

but how can I initialize it?

**** Unit1
unit Unit1;  {$mode objfpc}{$H+}
interface
uses  Classes, SysUtils;
type
  TBar = object
  private
    a: integer;
  public
    procedure Init;
  end;

implementation
procedure TBar.Init;
begin
  a := 0;
end;
end.


**** main program

program Project1;
uses Unit1;

function Foo: TBar;
begin
  Result.Init;
end;

begin
  Foo;
end.

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to