|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2007-07-26 10:41:16
on Tue Jul 24 2007, Pavel Syomin <syomin-AT-radico.ru> wrote:
> Hello!
>
> I don't sure, that I choose right mail list for my ofer... So, don't
> beat me much... :)
> I often use such macro for testing function parameters:
>
> #define THROW_INVALID_ARGUMENT_IF_FAIL(expression) \
> do { \
> using std::invalid_argument; \
> using std::string; \
> \
> if(!(expression)) \
> throw invalid_argument(string(BOOST_CURRENT_FUNCTION) + \
> " : Assertion '" #expression "' failed"); \
> } while(false)
>
> I think, that this macro is very useful and can be part of
> <boost/utility.hpp>.
I don't think we should include facilities that encourage responding
to precondition violations with exceptions.
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net