Delphi: the return value may be undefined, despite being configured after the start

can someone tell me why i get the "Return value ... maybe undefined" here:

function TXMLAcceptorBCOLSubmission.createRecordsInBCFEEPAR(AXML: TRipXMLElement): String;
var
  ...
begin
  Result := '';
+3
source share
2 answers

I am using Delphi 5 and it seems that the problem is caused by the declaration of more than 30 variables (I know, I know). It does not seem to matter what they are called or what they are.

+5
source

The following code does not generate a warning using Delphi 5, so

  • either this is a bug in another version of Delphi (you should mention the version you are using)
  • or either this is something that you have not yet shown to us.

the code

program ProveAPoint;
{$APPTYPE CONSOLE}
uses SysUtils;

type
  TRipXMLElement = record
  end;
  TXMLAcceptorBCOLSubmission = class
  public
    function createRecordsInBCFEEPAR(AXML: TRipXMLElement): string;
  end;

function TXMLAcceptorBCOLSubmission.createRecordsInBCFEEPAR(AXML: TRipXMLElement): String;
begin
  Result := '';
end;

var
  AXML: TRipXMLElement;
begin
  with TXMLAcceptorBCOLSubmission.Create do
  begin
     createRecordsInBCFEEPAR(AXML);
     Free;
  end;
end.
+2
source

Source: https://habr.com/ru/post/1763752/


All Articles