并非虚构...(一笑之)

王朝other·作者佚名  2006-01-08
窄屏简体版  字體: |||超大  

并非虚构... (一笑之)

作者:Chris Sells

译者:荣耀

我的一个朋友在微软源码中意外发现了如下代码:

//Function: RunCommandEx

//Synopsis: runs the given command in the current session, more robust

// than RunCommand

//Arguments: none

//Returns: S_OK if success

//History: October 3, 2000 - created [name withheld to protect the guilty]

HRESULT RunCommandEx(LPCWSTR szCmdLine)

{

DWORD dwTry = 0;

HRESULT hResult = S_OK;

//try run command 3 times at most

while (dwTry<4)

{

hResult = RunCommand(szCmdLine);

if (hResult!=E_FAIL)

{

//we succeeded

break;

}

dwTry++;

}

if (dwTry==4)

{

ATLTRACE(L"COuld start the command even we tried 4 times\n");

//译注:或许Chris的本意是

//ATLTRACE(L"Couldn't start the command even we tried 4 times\n");

ASSERT(FALSE);

}

return hResult;

}

这并非我所指的强健,但也不错...

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航