boost_no_exceptions.ipp 740 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // (C) Copyright John Maddock 2001.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/config for most recent version.
  6. // MACRO: BOOST_NO_EXCEPTIONS
  7. // TITLE: exception handling support
  8. // DESCRIPTION: The compiler in its current translation mode supports
  9. // exception handling.
  10. namespace boost_no_exceptions{
  11. void throw_it(int i)
  12. {
  13. throw i;
  14. }
  15. int test()
  16. {
  17. try
  18. {
  19. throw_it(2);
  20. }
  21. catch(int i)
  22. {
  23. return (i == 2) ? 0 : -1;
  24. }
  25. catch(...)
  26. {
  27. return -1;
  28. }
  29. return -1;
  30. }
  31. }