我赞成 白河愁 的说法
to com:我试过了,代码如下:
procedure TForm1.Button1Click(Sender: TObject);
const
CMAX = 999999999;
var
i : DWORD;
StartTime, UseTime : DWORD;
s : String;
begin
s := '';
Button1.Enabled := False;
StartTime := GetTickCount();
for i := 0 to CMAX do begin
if s = '' then;
end;
UseTime := GetTickCount() - StartTime;
Label1.Caption := IntToStr(UseTime);
Application.ProcessMessages();
StartTime := GetTickCount();
for i := 0 to CMAX do begin
if Length(s) = 0 then;
end;
UseTime := GetTickCount() - StartTime;
Label2.Caption := IntToStr(UseTime);
Button1.Enabled := True;
end;
结果第一个是:4927,第二个是:22192,明显是s=''快,不知你是怎么测的?