MCPcopy Create free account
hub / github.com/changkun/modern-cpp-tutorial / main

Function main

code/8/8.1.cpp:25–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23};
24
25int main()
26{
27 std::cout << std::boolalpha
28 << "may_throw() noexcept? " << noexcept(may_throw()) << std::endl
29 << "no_throw() noexcept? " << noexcept(no_throw()) << std::endl
30 << "lmay_throw() noexcept? " << noexcept(non_block_throw()) << std::endl
31 << "lno_throw() noexcept? " << noexcept(block_throw()) << std::endl;
32
33 try {
34 may_throw();
35 } catch (...) {
36 std::cout << "捕获异常, 来自 my_throw()" << std::endl;
37 }
38
39 try {
40 non_block_throw();
41 } catch (...) {
42 std::cout << "捕获异常, 来自 non_block_throw()" << std::endl;
43 }
44
45 try {
46 block_throw();
47 } catch (...) {
48 std::cout << "捕获异常, 来自 block_throw()" << std::endl;
49 }
50}

Callers

nothing calls this directly

Calls 2

may_throwFunction · 0.85
no_throwFunction · 0.85

Tested by

no test coverage detected