暮
暮佳雨
Unregistered / Unconfirmed
GUEST, unregistred user!
公司的培训资料里总结了很多对Delphi初学者来说很隐蔽的错误案例,这里摘抄两例,希望初学者共勉,大家有什么自己的案例体会,可以拿出来一起学习[]
procedure TForm1.Button1Click(Sender: TObject);
var
Pass:Cardinal;
S:string;
begin
Pass := 3331421845;
s:=IntToStr(Pass);
Pass := StrToInt(s);
ShowMessage(IntToStr(Pass));
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:Cardinal;
Lst:TStringList
begin
Lst := TStringList.Create;
for i := 0 to Lst.Count-1 do
begin
ShowMessage('Run');
Exit;
end;
Lst.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Pass:Cardinal;
S:string;
begin
Pass := 3331421845;
s:=IntToStr(Pass);
Pass := StrToInt(s);
ShowMessage(IntToStr(Pass));
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:Cardinal;
Lst:TStringList
begin
Lst := TStringList.Create;
for i := 0 to Lst.Count-1 do
begin
ShowMessage('Run');
Exit;
end;
Lst.Free;
end;