ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
Re: [boost] qeuestion about
by Peter Dimov other posts by this author
Sep 10 2003 10:47AM messages near this date
[boost] qeuestion about | [boost] halting graph algorithms
Robert Ramey wrote:
>  While studying <boost/throw_exception.hpp> I can't help but wonder
>  why it didn't include the following.
> 
>  namespace boost
>  {
> 
>  #ifdef BOOST_NO_EXCEPTIONS
> 
>  void throw_exception(std::exception const & e); // user defined
>  #define BOOST_TRY
>  #define BOOST_CATCH(x) if(0)
> 
>  #else
> 
>  template<class E> void throw_exception(E const & e)
>  {
>      throw e;
>  }
>  #define BOOST_TRY try
>  #define BOOST_CATCH(x) catch
> 
>  #endif
> 
>  }
> 
>  In this case,   one could replace try and catch throughout the program
>  with BOOST_TRY and BOOST_CATCH and have the program
>  automatically build with or without exceptions as appropriate.

Do you have a specific compiler in mind? On MSVC, for instance, try/catch
compile and "work" with exceptions "disabled". You do get an "exceptions
disabled" warning on try, but with if(0) you'd get an "unreachable code"
warning.

It is also worth mentioning that when exceptions are disabled the try/catch
equivalent when wrapping new is to test for 0, not simply ignore the catch
block.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Robert Ramey
Peter Dimov

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved