在较旧的程序代码的审查过程中出现以下问题:方法中的所有局部变量在开始之后立即初始化.通常局部变量未初始化.但我们有一个程序,所有变量都初始化为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)