大佬教程收集整理的这篇文章主要介绍了在delphi 7中,是`try …除了raise;结束;“有意义吗?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
with ADOQuery1 do begin // .. fill out sql.text,etc try execSQL; except raise; end; end;
在我看来,这些尝试块可以被删除,因为它们什么都不做.但是,我对可能出现的微妙副作用持谨慎态度.
任何人都可以想到这些块实际上可以做任何没有它们的情况下会发生的事情吗?
try someOperation; except on e: ECustomException do someCustomHandelr; else begin // the raise is only useful to rethrow the exception to an encompasing // handler. In this case after I have called my logger code. as Rob // mentioned this can be omitted if you arent handling anything because // the compiler will simply jump you to the next block if there is no // else. LogUnexpectedException('some operation failed',E); raise; end; end;
小心有没有“加注”的类似外观形式,它具有吃/隐藏任何例外的副作用.非常肆无忌惮的开发人员的实践,他们希望能够在竞争中占据一席之地.
with ADOQuery1 do begin // .. fill out sql.text,etc try execSQL; except // no handler so this just eats any "errors" end;
以上是大佬教程为你收集整理的在delphi 7中,是`try …除了raise;结束;“有意义吗?全部内容,希望文章能够帮你解决在delphi 7中,是`try …除了raise;结束;“有意义吗?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。