可能重复:
Delphi Exception Handling - How to clean up properly?
Use of Try/Finally/Catch Together in Delphi
我想知道将try-except-finally
放入delphi的最佳方法是哪种?我的意思是在嵌套的try块中,哪个语句应该在里面,例如,例1
// initialize / allocate resource (create objects etc.)
...
try
try
// use resource
...
except
// handle exception
...
end;
finally
// free resource / cleanup
...
end
示例2
// initialize / allocate resource (create objects etc.)
...
try
try
// use resource
...
finally
// free resource / cleanup
...
end;
except
// handle exception
...
end
在Delphi,例1或例2中处理异常的最佳方法是什么?