This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

11
cppdraft/exception/syn.md Normal file
View File

@@ -0,0 +1,11 @@
[exception.syn]
# 17 Language support library [[support]](./#support)
## 17.9 Exception handling [[support.exception]](support.exception#exception.syn)
### 17.9.2 Header <exception> synopsis [exception.syn]
// all freestandingnamespace std {class exception; class bad_exception; class nested_exception; using terminate_handler = void (*)();
terminate_handler get_terminate() noexcept;
terminate_handler set_terminate(terminate_handler f) noexcept; [[noreturn]] void terminate() noexcept; constexpr int uncaught_exceptions() noexcept; using exception_ptr = *unspecified*; constexpr exception_ptr current_exception() noexcept; [[noreturn]] constexpr void rethrow_exception(exception_ptr p); template<class E> constexpr exception_ptr make_exception_ptr(E e) noexcept; template<class E> constexpr const E* exception_ptr_cast(const exception_ptr& p) noexcept; template<class E> void exception_ptr_cast(const exception_ptr&&) = delete; template<class T> [[noreturn]] constexpr void throw_with_nested(T&& t); template<class E> constexpr void rethrow_if_nested(const E& e);}

View File

@@ -0,0 +1,113 @@
[exception.terminate]
# 17 Language support library [[support]](./#support)
## 17.9 Exception handling [[support.exception]](support.exception#exception.terminate)
### 17.9.5 Abnormal termination [exception.terminate]
#### [17.9.5.1](#terminate.handler) Type terminate_handler [[terminate.handler]](terminate.handler)
[🔗](#lib:terminate_handler)
`using terminate_handler = void (*)();
`
[1](#terminate.handler-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4010)
The type of a [*handler function*](#def:handler_function) to be invoked by terminatewhen terminating exception processing[.](#terminate.handler-1.sentence-1)
[2](#terminate.handler-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4016)
*Required behavior*: A terminate_handler shall
terminate execution of the program without returning to the caller[.](#terminate.handler-2.sentence-1)
[3](#terminate.handler-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4021)
*Default behavior*: The implementation's default terminate_handler callsabort()[.](#terminate.handler-3.sentence-1)
#### [17.9.5.2](#set.terminate) set_terminate [[set.terminate]](set.terminate)
[🔗](#lib:set_terminate)
`terminate_handler set_terminate(terminate_handler f) noexcept;
`
[1](#set.terminate-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4036)
*Effects*: Establishes the function designated by f as the current
handler function for terminating exception processing[.](#set.terminate-1.sentence-1)
[2](#set.terminate-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4041)
*Returns*: The previous terminate_handler[.](#set.terminate-2.sentence-1)
[3](#set.terminate-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4045)
*Remarks*: It is unspecified whether a null pointer value designates the defaultterminate_handler[.](#set.terminate-3.sentence-1)
#### [17.9.5.3](#get.terminate) get_terminate [[get.terminate]](get.terminate)
[🔗](#lib:get_terminate)
`terminate_handler get_terminate() noexcept;
`
[1](#get.terminate-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4059)
*Returns*: The current terminate_handler[.](#get.terminate-1.sentence-1)
[*Note [1](#get.terminate-note-1)*:
This can be a null pointer value[.](#get.terminate-1.sentence-2)
— *end note*]
#### [17.9.5.4](#terminate) terminate [[terminate]](terminate)
[🔗](#lib:terminate_)
`[[noreturn]] void terminate() noexcept;
`
[1](#terminate-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4075)
*Effects*: Calls a terminate_handler function[.](#terminate-1.sentence-1)
It is unspecified whichterminate_handler function will be called if an exception is active
during a call to set_terminate[.](#terminate-1.sentence-2)
Otherwise calls the current terminate_handler function[.](#terminate-1.sentence-3)
[*Note [1](#terminate-note-1)*:
A
default terminate_handler is always considered a callable handler in
this context[.](#terminate-1.sentence-4)
— *end note*]
[2](#terminate-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4087)
*Remarks*: Called by the implementation when exception
handling must be abandoned for any of several reasons ([[except.terminate]](except.terminate "14.6.2The std::terminate function"))[.](#terminate-2.sentence-1)
May also be called directly by the program[.](#terminate-2.sentence-2)