Delphi:返回值可能未定义,尽管在开始后设置它

发布于 2024-09-18 04:45:40 字数 187 浏览 14 评论 0原文

谁能告诉我为什么我在这里得到“返回值......可能未定义”:

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

can anyone tell me why I get "Return value ... might be undefined" here:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云醉月微眠 2024-09-25 04:45:40

我正在使用 Delphi 5,看起来问题是由声明超过 30 个变量引起的(我知道,我知道)。它们叫什么或者是什么类型似乎并不重要。

I am using Delphi 5 and it looks like the problem is caused by declaring more than 30 variables (I know, I know). It doesn't seem to matter what they are called or what types they are.

寒尘 2024-09-25 04:45:40

以下代码不会使用 Delphi 5 生成警告,因此

  • 它要么是其他 Delphi 版本中的错误(您应该提及您使用的版本)
  • ,要么是您尚未向我们展示的内容。

代码

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.

Following code doesn't generate a warning using Delphi 5 so

  • either it is a bug in an other Delphi version (you should mention the version you use)
  • or either it is something you didn't show us yet.

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文