Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-05-24 08:27:45


Andreas Huber <ah2003_at_[hidden]> writes:

>> >
>> > Ok, but how do you propose should the state machine then be terminated? By
>> > simply not calling the exit actions of still active states?
>>
>> Yes, why not?
>
> Because that would essentially be the same as destructing an object by not
> calling its destructor (i.e. by only deallocating the memory).

That's circular logic.

> I'm not only saying this because an active state happens to be an
> object in boost::fsm. State machines frequently acquire resources
> in entry actions and dispose of them in exit actions. Those
> resources would simply be leaked if there's no guarantee that exit
> actions are called under all non-fatal error situations.

It seems reasonable that well-designed state objects should also
deallocate any resources they own in their destructors. It doesn't
neccessarily seem reasonable as a consequence to force all exit
actions into the state's destructor.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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