Files
cppdraft_translate/cppdraft/new/handler.md
2025-10-25 03:02:53 +03:00

39 lines
1.2 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[new.handler]
# 17 Language support library [[support]](./#support)
## 17.6 Dynamic memory management [[support.dynamic]](support.dynamic#new.handler)
### 17.6.4 Storage allocation errors [[alloc.errors]](alloc.errors#new.handler)
#### 17.6.4.3 Type new_handler [new.handler]
[🔗](#lib:new_handler)
`using new_handler = void (*)();
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3087)
The type of a[*handler function*](#def:handler_function) to be called byoperator new() oroperator new[]() ([[new.delete]](new.delete "17.6.3Storage allocation and deallocation")) when they cannot satisfy a request for additional storage[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3095)
*Required behavior*: A new_handler shall perform one of the following:
- [(2.1)](#2.1)
make more storage available for allocation and then return;
- [(2.2)](#2.2)
throw an exception of typebad_alloc or a class derived frombad_alloc;
- [(2.3)](#2.3)
terminate execution of the program without returning to the caller[.](#2.sentence-1)