]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/core/doc/no_exceptions_support.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / core / doc / no_exceptions_support.qbk
CommitLineData
7c673cae
FG
1[/
2 Copyright 2004 Pavel Vozenilek
3 Copyright 2014 Peter Dimov
4
5 Distributed under the Boost Software License, Version 1.0.
6
7 See accompanying file LICENSE_1_0.txt
8 or copy at http://boost.org/LICENSE_1_0.txt
9]
10
11[section:no_exceptions_support no_exceptions_support]
12
13[simplesect Authors]
14
15* Pavel Vozenilek
16
17[endsimplesect]
18
19[section Header <boost/core/no_exceptions_support.hpp>]
20
21The header `<boost/core/no_exceptions_support.hpp>` defines
22macros for use in code that needs to be portable to environments
23that do not have support for C++ exceptions.
24
25[section Synopsis]
26
27``
28#define BOOST_TRY /*unspecified*/
29#define BOOST_CATCH(x) /*unspecified*/
30#define BOOST_CATCH_END /*unspecified*/
31#define BOOST_RETHROW /*unspecified*/
32``
33
34[endsect]
35
36[section Example Use]
37
38``
39void foo() {
40 BOOST_TRY {
41 ...
42 } BOOST_CATCH(const std::bad_alloc&) {
43 ...
44 BOOST_RETHROW
45 } BOOST_CATCH(const std::exception& e) {
46 ...
47 }
48 BOOST_CATCH_END
49}
50``
51
52With exception support enabled it will expand into:
53
54``
55void foo() {
56 { try {
57 ...
58 } catch (const std::bad_alloc&) {
59 ...
60 throw;
61 } catch (const std::exception& e) {
62 ...
63 }
64 }
65}
66``
67
68With exception support disabled it will expand into:
69
70``
71void foo() {
72 { if(true) {
73 ...
74 } else if (false) {
75 ...
76 } else if (false) {
77 ...
78 }
79 }
80}
81``
82
83[endsect]
84
85[endsect]
86
87[endsect]