Delphi &引用;“无返回值”;如果使用continue?
作为。没有关系。对继续进行while/repeat循环有错误的直觉。出丑:-) 请参阅注释行。 如果我取消它的注释,编译就可以了。 若我对它进行注释,那个么将给出关于未定义结果的警告。 编译器似乎无法解释诸如Break和Continue之类的伪过程 以前的Delphi版本是否会出现这种情况? 有QC吗Delphi &引用;“无返回值”;如果使用continue?,delphi,warnings,return-value,delphi-xe2,Delphi,Warnings,Return Value,Delphi Xe2,作为。没有关系。对继续进行while/repeat循环有错误的直觉。出丑:-) 请参阅注释行。 如果我取消它的注释,编译就可以了。 若我对它进行注释,那个么将给出关于未定义结果的警告。 编译器似乎无法解释诸如Break和Continue之类的伪过程 以前的Delphi版本是否会出现这种情况? 有QC吗 //returns 0 or win32 error code function TfmMain.callQDN(DeviceName: string; out buff: string):
//returns 0 or win32 error code
function TfmMain.callQDN(DeviceName: string;
out buff: string): DWORD;
const len_step = 8192;
var res, len, err: DWORD;
lpDeviceName: PChar;
begin
SetLength(buff, len_step);
len := Length(buff);
lpDeviceName := nil;
if DeviceName>'' then lpDeviceName := @DeviceName[1];
repeat
Res := QueryDosDevice(lpDeviceName, @buff[1], len);
if Res = 0 then begin
err := GetLastError;
// Result := err;
if err = ERROR_INSUFFICIENT_BUFFER then begin
len := len_step + len;
SetLength(buff, len);
continue;
end;
Result := err;
end else begin
Result := 0;
SetLength(buff, res); // res+1 ?
end;
until (Result = 0);
end;
我很笨
继续重新检查条件,而不只是再次启动循环体此处的文档没有帮助。在
继续之后立即评估条件之前,并不十分清楚。在重复
循环中,继续
相当于转到
。更一般地说,在任何循环中,继续
相当于(但不是完全)转到循环体的末端。