43 lines
1.2 KiB
Markdown
43 lines
1.2 KiB
Markdown
[utility.undefined]
|
||
|
||
# 22 General utilities library [[utilities]](./#utilities)
|
||
|
||
## 22.2 Utility components [[utility]](utility#undefined)
|
||
|
||
### 22.2.9 Undefined behavior [utility.undefined]
|
||
|
||
[ð](#lib:unreachable)
|
||
|
||
`[[noreturn]] void unreachable();
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L696)
|
||
|
||
*Preconditions*: false is true[.](#1.sentence-1)
|
||
|
||
[*Note [1](#note-1)*:
|
||
|
||
This precondition cannot be satisfied, thus the behavior
|
||
of calling unreachable is undefined[.](#1.sentence-2)
|
||
|
||
â *end note*]
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L704)
|
||
|
||
[*Example [1](#example-1)*: int f(int x) {switch (x) {case 0:case 1:return x; default: std::unreachable(); }}int a = f(1); // OK, a has value 1int b = f(3); // undefined behavior â *end example*]
|
||
|
||
[ð](#lib:observable_checkpoint)
|
||
|
||
`void observable_checkpoint() noexcept;
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L728)
|
||
|
||
*Effects*: Establishes an observable checkpoint ([[intro.abstract]](intro.abstract "4.1.2 Abstract machine"))[.](#3.sentence-1)
|