正在加载图片...
传统错误处理:通过函数返回值 readFile initialize errorcode=0i open the filei the Fileopen) determine its size if(getTheFileLenght t allocate the much memory; if(getEnough Memory read the file into memory: (readFailed) errorCode=-1 } felse t error Code=-2: felse t errorCode=-3: close the file if(the FildDidntclose & errorCode==ort errorcode 4 felse t errorCode else t errorCode=-6: return errorCode传统错误处理:通过函数返回值 readFile{ initialize errorCode=0; open the file; if(theFilesOpen){ determine its size; if(getTheFileLenght){ allocate the much memory; if(getEnoughMemory){ read the file into memory; if(readFailed){ errorCode=-1; } }else { errorCode=-2; } }else { errorCode=-3; } close the file; if(theFildDidntClose && errorCode==0){ errorCode=-4; }else { errorCode=-5; } } else { errorCode=-6; } return errorCode; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有