Boost logo

Boost :

From: Martin (m_at_[hidden])
Date: 2002-10-30 09:35:13


> The biggest problem I see is that you have no safe way to test invariants
> from a destructor. There can be no return value from a destructor and
> destructors should never throw if exception-safety is any kind of goal
> (because if you arrived at that destructor because run() threw, for
example,
> and then the destructor threw, you'd end up with a terminated thread
pretty
> quickly...)

Hmm, possibly I took a naive approach. I assumed that if run() throws and
then invariants test throws than since the code in the destructor should
actually not be doing anything to the class then everithing would be fine.

> As for the rest, well, I'm having difficulty envisioning how you mean to
> make this generic. Where will the author provide implementations for
> preconditions, body, postconditions, etc. if not explicitly in the class
> body as you have now?
> Marc
>

well, deriving from a class with pure virtual pre(), body() and post()
functions could do it. Perhaps C++ limits this to be possible. Is there a
way to make the body() function think it is in the scope of the functions
such that it could access the parameters directly?


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