Boost logo

Boost :

From: Jarl Lindrud (jlindrud_at_[hidden])
Date: 2005-04-17 13:46:49


Yariv Tal <yariv_tal2003 <at> hotmail.com> writes:

> Do you check at compile time that the used gave all of the variables
> participating in the expression or do you just let the user state which
> variables they want to be displayed in the error message?

The user just states which variables he'd like to see printed, if the condition
were to fail, and its fine not to specify any variables at all.

>
> One thing though, I didn't see any handling of disabling testing post
> conditions when
> an exception is thrown.
> Did I miss something?

No you didn't... guilty as charged :)

>
> >
> > Since these macros are part of the function implementation, maybe one
> shouldn't
> > borrow the name "Design By Contract", since that implies a contract
> external to
> > the function. Proper DbC contracts need to be stated at the level of
> function
> > declarations, and would apply to overrides in derived classes as well.
> Point taken.
> Originally I was hoping to add invariants etc., but I didn't get to it.
> Of course, even with invariants it will still be more at the function level.
> In general, I think there's a lot to do (temporal invariants as in "keystone
> ", for example)
> and since it is so useful (a fact I discover every time a condition in my
> code is invalidated)
> it think, IMHO, it should be a library for all to use and for many to
> contribute to.

Agreed. Formalizing the PRECONDITION and POSTCONDITION macros would be quite
useful, I think. But I wouldn't be too worried about trying to emulate DbC,
that's a different concept altogether.

/Jarl.


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