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
[boost] qeuestion about
by Robert Ramey other posts by this author
Sep 10 2003 4:29AM messages near this date
Re: [boost] defining export pragmas for windows. | Re: [boost] qeuestion about
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.

BOOST_TRY
{
	...
}
BOOST_CATCH(...)
{
}

would be rendered as 
try{
	...
}
catch(...)
{
	....
}

on systems supporting exceptions and

{
	...
}
if(0){
	.... // no op
}

on systems that don't support exceptions.

What am I mising here?
_______________________________________________
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