首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

請問 C++ Builder 裡的 Abort() 之用场與使用時機

2013-09-05 
請問 C++ Builder 裡的 Abort() 之用途與使用時機?非小寫開頭的 abort()[解决办法]Use Abort to escape fr

請問 C++ Builder 裡的 Abort() 之用途與使用時機?
非小寫開頭的 abort()


[解决办法]
Use Abort to escape from an execution path without reporting an error.

Abort raises a special "silent exception" (EAbort), which operates like any other exception, but does not display an error message to the end user.  Abort redirects execution to the end of the last try .. __finally block.
[解决办法]
VCL中大量使用事件,事件是通过回调实现了, Abort抛出一个沉默的异常,终止当前事件的执行。后续的事件链也不会执行了。

当你在一个“自己的事务”中,有多个回调函数时,如果想中止事务的执行,可以用 Abort();


Abort()异常与其他异常的差异在于:这是一个 silent exception 。
它的作用就是通过异常改变事件预定的执行顺序。无论在CB中或Delphi中,其作用是一样的。


热点排行