Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-04-18 08:49:07


--- In boost_at_y..., Jesse Jones <jesjones_at_h...> wrote:
> >I've uploaded an updated header and a test file. The original
issues
> >have still not been addressed (i.e. configurable asserts, et. al.)
> >but a minimal DbC usage is now possible. I took the easy way out
for
> >providing simple invariant specifications and many may not like the
> >heavy use of macros. I'd love to see better
designs/implementations
> >here, but what's posted illustrates how we can get a minimal DbC
with
> >out impacting class design or limiting usage to only classes (i.e.
> >preconditions and postconditions work just as well with stand alone
> >functions).
>
> What will preconditions and postconditions do inside free
functions?
> Just assert?

The same thing they do inside member functions. The only thing this
means is that precondition checks don't automatically create our
invariant checking mechanism. You need to use BOOST_CHECK_INVARIANTS
for this, which would be valid only inside of member functions.
There are several benefits to this approach (it works well with c-tor
and d-tor assertions, it insures only one check even if multiple
BOOST_REQUIRE calls are made, etc.), even though it means an extra
call is needed to be added manually by users.

Bill Kempf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk