小编eli*_*ite的帖子

在delphi中初始化局部变量?

在较旧的程序代码的审查过程中出现以下问题:方法中的所有局部变量在开始之后立即初始化.通常局部变量未初始化.但我们有一个程序,所有变量都初始化为0.是否有人知道如何发生这种情况?

例:

type
  TPrices = array[0..10, 0..5] of Integer;

procedure DoSomething();
var
  mPrices : TPrices;
  mValue  : Integer; 
begin
  if (mPrices[0,0] = 0) then
    MessageDlg('Zero', mtInformation, [mbOK], 0);
  if (mValue = 0) then
    MessageDlg('Zero Integer', mtInformation, [mbOK], 0);
end;
Run Code Online (Sandbox Code Playgroud)

delphi variables initialization

-1
推荐指数
1
解决办法
1583
查看次数

标签 统计

delphi ×1

initialization ×1

variables ×1