std::terminate_handler

出自cppreference.com
< cpp‎ | error
在標頭 <exception> 定義
typedef void (*terminate_handler)();

std::terminate_handler 是函數指針類型(指向不接收實參且返回 void 的函數),這些函數由 std::set_terminate 安裝,由 std::get_terminate 查詢,並由 std::terminate 調用。

std::terminate_handler 應當終止程序的執行而不返回到調用方,否則其行為未定義。

C++ 實現提供默認的 std::terminate_handler 函數,它調用 std::abort()。若安裝了空指針值(通過 std::set_terminate),則實現可以恢復默認安裝的處理函數。

[編輯] 示例

[編輯] 參閱

異常處理失敗時調用的函數
(函數) [編輯]
更改將被 std::terminate 調用的函數
(函數) [編輯]
獲得當前的 terminate_handler
(函數) [編輯]