no_exceptions_support.qbk 1.3 KB

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